CookieHandler.WriteCore 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
在衍生類別中覆寫時,寫入與指定的要求相關聯的 Cookie,其具有指定的名稱、值、網域、路徑、到期時間、持續性和可見度。
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)
參數
- value
- Byte[]
Cookie 值。
- name
- String
Cookie 的名稱。
- path
- String
Cookie 的路徑。
- domain
- String
Cookie 的網域。
- expirationTime
- DateTime
Cookie 的到期時間,或會話的 DateTime.MinValue (僅限會話) Cookie。
- secure
- Boolean
如果 Cookie 只能透過 SSL 連線使用,則為 true
,否則為false
。
- httpOnly
- Boolean
如果應該對用戶端指令碼隱藏 Cookie,則為 true
,否則為 false
。
- context
- HttpContext
要求的 HttpContext。
備註
從多載 Write 方法呼叫,以執行寫入 Cookie 的實際工作。 方法 Write 可確保 value
是非空白位元組陣列, name
而且是 path
非空字串。
給實施者的注意事項
您必須覆寫這個方法。 實作完全由開發人員決定。 在一般情況下,實作會將 Cookie 數據 Cookies 寫入集合,但這不是必要條件。 方法的大部分參數通常用來在一或多個 HttpCookie 對象上設定對等的屬性。
適用於
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應