HttpCookie.Shareable 屬性

定義

判斷 cookie 是否可以參與輸出快取。

public:
 property bool Shareable { bool get(); void set(bool value); };
public bool Shareable { get; set; }
member this.Shareable : bool with get, set
Public Property Shareable As Boolean

屬性值

Boolean

若要指定包含一個或多個輸出 Cookie 的特定 HttpResponse 不會隱藏輸出快取則為 true,否則為 false

備註

如果指定的 HttpResponse 包含一或多個輸出 Cookie,且 Shareable 設定為 false (預設值) ,則會隱藏回應的輸出快取。 這可防止包含潛在敏感性資訊的 Cookie 在回應中快取,並傳送至多個用戶端。 若要允許快取包含 Cookie 的回應,請為回應設定一般快取,例如使用 OutputCache 指示詞或 MVC 的 [OutputCache] 屬性,並將所有輸出 Cookie Shareable 設為 true

適用於