CookieHandler.WriteCore Method

Definition

When overridden in a derived class, writes a cookie associated with the specified request that has the specified name, value, domain, path, expiration time, persistence and visibility.

C#
protected abstract void WriteCore(byte[] value, string name, string path, string domain, DateTime expirationTime, bool secure, bool httpOnly, System.Web.HttpContext context);

Parameters

value
Byte[]

The cookie value.

name
String

The name of the cookie.

path
String

The path for the cookie.

domain
String

The domain for the cookie.

expirationTime
DateTime

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

secure
Boolean

true if the cookie should only be used over an SSL connection; otherwise, false.

httpOnly
Boolean

true if the cookie should be hidden from client script; otherwise, false.

context
HttpContext

The HttpContext for the request.

Remarks

Called from the overloaded Write methods to do the actual work of writing the cookie. The Write methods will ensure that value is a non-empty byte array and that name and path are non-empty strings.

Notes to Implementers

You must override this method. The implementation is entirely up to the developer. In the typical case, implementations write the cookie data to the Cookies collection, however, this is not a requirement. Most parameters of the method are typically used to set equivalent properties on one or more HttpCookie objects.

Applies to

Product Versions
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1