HttpResponse.SuppressDefaultCacheControlHeader 屬性

定義

取得或設定值,這個值表示是否要隱藏目前 HTTP 回應的預設 Cache Control: private 標頭。Gets or sets a value indicating whether to suppress the default Cache Control: private header for the current HTTP response.

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

屬性值

true若要隱藏目前 HTTP 回應的預設Cache Control: private標頭;否則為falsetrue to suppress the default Cache Control: private header for the current HTTP response; otherwise, false.

備註

根據預設,ASP.NET Cache-Control: private會傳送回應標頭,除非已指定此回應的明確快取原則。By default, ASP.NET sends a Cache-Control: private response header unless an explicit cache policy has been specified for this response. 此屬性可讓您根據每個要求來隱藏此預設回應標頭。This property allows suppressing this default response header on a per-request basis. 您仍然可以針對整個應用程式隱藏標頭,方法SendCacheControlHeader是針對快取設定HTTPRuntime 元素(ASP.NET 設定架構)outputCache 元素(ASP.NET 設定架構)The header can still be suppressed for the entire application by setting SendCacheControlHeader in httpRuntime Element (ASP.NET Settings Schema) or outputCache Element for caching (ASP.NET Settings Schema).

隱藏預設Cache-Control: private標頭時請務必小心,因為 proxy 和其他媒介可能會將沒有此標頭的回應視為預設為可快取。Use caution when suppressing the default Cache-Control: private header, as proxies and other intermediaries may treat responses without this header as cacheable by default. 這種處理方式可能會導致敏感資訊的意外快取。This treatment can lead to the inadvertent caching of sensitive information. 如需詳細資訊,請參閱RFC 2616,秒 13.4See RFC 2616, Sec. 13.4 for more information.

適用於