HttpResponse.SuppressDefaultCacheControlHeader 属性


获取或设置一个值,该值指示是否取消默认缓存控件:当前 HTTP 响应的专用标头。Gets or sets a value indicating whether to suppress the default Cache Control: private header for the current HTTP response.

 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 响应的专用标头;否则为falsetrue to suppress the default Cache Control: private header for the current HTTP response; otherwise, false.


默认情况下,除非已Cache-Control: private为此响应指定了显式缓存策略,否则 ASP.NET 将发送响应标头。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标头时要格外小心,因为代理和其他中介可以在默认情况下将没有此标头的响应视为可缓存。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.4。See RFC 2616, Sec. 13.4 for more information.