แก้ไข

แชร์ผ่าน


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.

protected:
 abstract void WriteCore(cli::array <System::Byte> ^ value, System::String ^ name, System::String ^ path, System::String ^ domain, DateTime expirationTime, bool secure, bool httpOnly, System::Web::HttpContext ^ context);
protected abstract void WriteCore (byte[] value, string name, string path, string domain, DateTime expirationTime, bool secure, bool httpOnly, System.Web.HttpContext context);
abstract member WriteCore : byte[] * string * string * string * DateTime * bool * bool * System.Web.HttpContext -> unit
Protected MustOverride Sub WriteCore (value As Byte(), name As String, path As String, domain As String, expirationTime As DateTime, secure As Boolean, httpOnly As Boolean, context As HttpContext)

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