System.Web.Security.WindowsAuthenticationModule.Authenticate Event

Occurs when the application authenticates the current request.

Syntax

public event WindowsAuthenticationEventHandler Authenticate

Remarks

The WindowsAuthenticationModule.Authenticate event is raised during the System.Web.HttpApplication.AuthenticateRequest event.

You can access the WindowsAuthenticationModule.Authenticate event of the System.Web.Security.WindowsAuthenticationModule class by specifying a subroutine named WindowsAuthentication_OnAuthenticate in the Global.asax file for your ASP.NET application.

You can use the WindowsAuthenticationEventArgs.User property of the System.Web.Security.WindowsAuthenticationEventArgs object supplied to the WindowsAuthentication_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 WindowsAuthenticationEventArgs.User property during the WindowsAuthentication_OnAuthenticate event, the Windows identity supplied by IIS is used as the identity for the current request. If IIS uses anonymous authentication, then the WindowsAuthenticationEventArgs.Identity property is set to the identity returned by the System.Security.Principal.WindowsIdentity.GetAnonymous method.

The WindowsAuthentication_OnAuthenticate event is raised only when the authentication System.Web.Configuration.AuthenticationSection.Mode is set to System.Web.Configuration.AuthenticationMode.Windows and the System.Web.Security.WindowsAuthenticationModule is an active HTTP module for the application.

Note:

In IIS 7.0 running in Integrated Mode, the WindowsAuthenticationModule.Authenticate event of the System.Web.Security.WindowsAuthenticationModule is not raised when both the ASP.NET System.Web.Security.WindowsAuthenticationModule and the IIS AnonymousAuthenticationModule modules are enabled. In this scenario, to receive authentication notification, subscribe to the System.Web.HttpApplication.AuthenticateRequest event of the System.Web.HttpApplication instance. For more information about compatibility issues in Integrated modes, see Moving an ASP.NET Application from IIS 6.0 to IIS 7.0.

Requirements

Namespace: System.Web.Security
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0