AuthenticationService.CreatingCookie Event

 

Occurs when the authentication cookie is being set.

Namespace:   System.Web.ApplicationServices
Assembly:  System.Web.Extensions (in System.Web.Extensions.dll)

static member CreatingCookie : IEvent<EventHandler<CreatingCookieEventArgs>,
    CreatingCookieEventArgs>

The CreatingCookie event is raised when the authentication cookie is being set after user credentials have been validated. Create an event handler for the CreatingCookie event to customize the authentication cookie.

The following example shows how to bind an event handler to the CreatingCookie event in the Application_Start method of the Global.asax file.

No code example is currently available or this language may not be supported.

The following example shows an event handler for the CreatingCookie event in the Global.asax file. The event handler customizes the authentication cookie by adding the value in the CustomCredential property to the UserData property. Store the CustomCredential property in a cookie only if you know that the data in the property is not sensitive. Malicious users can access the values in the cookie.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 3.5
Return to top
Show: