CookieHandler.Write Method (Byte[], String, DateTime)

.NET Framework (current version)

Writes a cookie associated with the current request that has the specified name, value, and expiration time.

Namespace:   System.IdentityModel.Services
Assembly:  System.IdentityModel.Services (in System.IdentityModel.Services.dll)

public void Write(
	byte[] value,
	string name,
	DateTime expirationTime


Type: System.Byte[]

The cookie value.

Type: System.String

The name of the cookie.

Type: System.DateTime

The expiration time for the cookie, or MinValue for a session (session-only) cookie.

Exception Condition

value is null or empty.


name is null or empty.

The cookie domain and path are specified by the Domain and Path properties. The request is specified by HttpContext.Current. The request is specified by Current. Whether the cookie should be sent only over SSL is specified by the RequireSsl property and whether the cookie should be hidden from client-side scripts is specified by the HideFromClientScript property.

.NET Framework
Available since 4.5
Return to top