Represents the method that handles the DefaultAuthentication_OnAuthenticate event of a System.Web.Security.DefaultAuthenticationModule.
- sender
- Documentation for this section has not yet been entered.
- e
- Documentation for this section has not yet been entered.
The System.Web.Security.DefaultAuthenticationEventHandler delegate is defined for the DefaultAuthenticationModule.Authenticate event of the System.Web.Security.DefaultAuthenticationModule class. You can access the DefaultAuthenticationModule.Authenticate event of the System.Web.Security.DefaultAuthenticationModule class by specifying a subroutine named DefaultAuthentication_OnAuthenticate in the Global.asax file for your ASP.NET application. The DefaultAuthenticationModule.Authenticate event is raised after the System.Web.HttpApplication.AuthenticateRequest event and is used to ensure that the System.Web.HttpContext.User property of the current System.Web.HttpContext is populated with an System.Security.Principal.IPrincipal object.
You can use the DefaultAuthenticationEventArgs.Context property of the System.Web.Security.DefaultAuthenticationEventArgs object supplied to the DefaultAuthentication_OnAuthenticate event to set the System.Web.HttpContext.User property of the current System.Web.HttpContext to a custom System.Security.Principal.IPrincipal object. If you do not specify a value for the System.Web.HttpContext.User property of the System.Web.HttpContext supplied during the DefaultAuthentication_OnAuthenticate event, the System.Web.Security.DefaultAuthenticationModule sets the System.Web.HttpContext.User property of the System.Web.HttpContext to a System.Security.Principal.GenericPrincipal object that contains no user information.
The DefaultAuthentication_OnAuthenticate event is raised after the System.Web.HttpApplication.AuthenticateRequest event and before the System.Web.HttpApplication.AuthorizeRequest event. If you have an authorization section that depends on the user name to deny or allow access to your application, modifying the System.Web.HttpContext.User property of the current System.Web.HttpContext can affect the behavior of your application. Be sure that the user name you set during the DefaultAuthentication_OnAuthenticate event is considered when you specify the authorization section in your configuration.