HttpResponse.SuppressDefaultCacheControlHeader 属性

定义

获取或设置一个值,该值指示是否取消默认缓存控件:当前 HTTP 响应的专用标头。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

属性值

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 settings schema) 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.

适用于