Partager via


Handling Forms Authentication Events

You can handle forms authentication events to customize the following aspects of the forms authentication process:

  • How the forms authentication ticket is created.

  • How the User property is set.

To perform these tasks, you can handle the FormsAuthentication_OnAuthenticate event in an application's Global.asax file. Typically forms authentication manages these tasks for you. However, in your applications, you might have specific authentication requirements, such as setting the User property to a custom class that implements the IPrincipal interface. For more information, see FormsAuthenticationEventHandler.

When you access forms authentication through the authentication service, you can handle the Authenticating event to customize how the user credentials are verified. You can handle the CreatingCookie event to customize the content of the authentication cookie returned by the service. For more information, see How to: Customize User Login When Using the WCF Authentication Service and How to: Customize the Authentication Cookie from the WCF Authentication Service.

See Also

Other Resources

ASP.NET Web Application Security

Forms Authentication Provider