HttpResponse.CacheControl HttpResponse.CacheControl HttpResponse.CacheControl HttpResponse.CacheControl Property


获取或设置与 HttpCacheability 枚举值之一匹配的 Cache-Control HTTP 标头。Gets or sets the Cache-Control HTTP header that matches one of the HttpCacheability enumeration values.

 property System::String ^ CacheControl { System::String ^ get(); void set(System::String ^ value); };
public string CacheControl { get; set; }
member this.CacheControl : string with get, set
Public Property CacheControl As String


HttpCacheability 枚举值的字符串表示形式。A string representation of the HttpCacheability enumeration value.


设置的字符串值与 HttpCacheability 枚举值之一不匹配。The string value set does not match one of the HttpCacheability enumeration values.


PrivatePublic和的No-Cache值是字符串,必须用引号("")引起来。The values for Private, Public, and No-Cache are strings and must be enclosed in quotation marks (" "). 如果将HttpCacheability ArgumentException属性设置为与枚举值之一不匹配的值,则会引发。 CacheControlIf the CacheControl property is set to a value that does not match one of the HttpCacheability enumeration values, then an ArgumentException is thrown. 如果未CacheControl设置该属性,则将响应的可缓存性设置为NoCacheIf the CacheControl property is not set, the cacheability of the response is set to NoCache.

CacheControl、和属性ExpiresAbsolute已弃用。 ExpiresThe CacheControl, Expires, and ExpiresAbsolute properties have been deprecated. 相反, HttpCachePolicy类的方法可Cache通过内部对象使用,以控制 Internet Information Services (IIS)输出缓存和客户端缓存。Instead, the methods of the HttpCachePolicy class are available through the Cache intrinsic object to control the Internet Information Services (IIS) output cache and client caches.