-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
ASP.NET Web API Security Essentials
By :
We just saw how to enable basic authentication with IIS. However, if the website is a publically available website, it is not possible to authenticate the user using Windows credentials. In such cases, the website should authenticate using the ASP.NET membership provider. In order to achieve this, we need to implement a custom membership with basic authentication.
Custom membership with basic authentication can be implemented using an HTTP module as given in the following:
public class BasicAuthHttpModule : IHttpModule
{
//...
}We need to create two methods and hook them to the AuthenticateRequest and EndRequest events in the Init method as given in the following code:
public void Init(HttpApplication context)
{
context.AuthenticateRequest +=
OnApplicationAuthenticateRequest;
context.EndRequest += OnApplicationEndRequest;
}As you can see OnApplicationAuthenticateRequest is added or registered to the AuthenticateRequest...
Change the font size
Change margin width
Change background colour