CreatingCookieEventArgs Class

Provides data for the CreatingCookie event.

System::Object
  System::EventArgs
    System.Web.ApplicationServices::CreatingCookieEventArgs

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

public ref class CreatingCookieEventArgs : public EventArgs

The CreatingCookieEventArgs type exposes the following members.

  NameDescription
Public propertyCookieIsSetGets or sets a value that indicates whether the authentication cookie has been created.
Public propertyCustomCredentialGets additional authentication values that are provided by the user.
Public propertyIsPersistentGets a value that indicates whether the authentication cookie should be retained beyond the current session.
Public propertyPasswordGets the password for the user.
Public propertyUserNameGets the name for the user.
Top

  NameDescription
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

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.

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

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft