CreatingCookieEventArgs Class
Provides data for the CreatingCookie event.
Assembly: System.Web.Extensions (in System.Web.Extensions.dll)
The CreatingCookieEventArgs type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | CookieIsSet | Gets or sets a value that indicates whether the authentication cookie has been created. |
![]() | CustomCredential | Gets additional authentication values that are provided by the user. |
![]() | IsPersistent | Gets a value that indicates whether the authentication cookie should be retained beyond the current session. |
![]() | Password | Gets the password for the user. |
![]() | UserName | Gets the name for the user. |
| Name | Description | |
|---|---|---|
![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
The CreatingCookieEventArgs class supplies values to any CreatingCookie event handler. By using the properties of this class, you can retrieve user credentials when you create a custom authentication cookie.
The AuthenticationService class raises the CreatingCookie event when it sets the authentication cookie, after the user credentials have been authenticated. The AuthenticationService class constructs a CreatingCookieEventArgs object and passes it to any CreatingCookie event handler.
You retrieve the user credentials through the UserName Password, and CustomCredential properties. The CustomCredential property can contain any custom values that you need in order to authenticate, such as an identification number. The IsPersistent property indicates whether the authentication cookie should be retained past the current session. Set the CookieIsSet property to true if you create the authentication cookie, so that the AuthenticationService class does not create the cookie.
The following example shows an event handler for the CreatingCookie event. The handler retrieves user values from the CreatingCookieEventArgs object to customize the authentication cookie. The handler saves the value from the CustomCredential property in the authentication ticket and sets the CookieIsSet property to true to indicate that the authentication cookie has been created.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.


