HttpResponse.CacheControl 属性

定义

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

public:
 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

属性值

String

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

例外

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

注解

Private、和的值 Public No-Cache 是字符串,必须用引号引起来 ( "" ) 。The values for Private, Public, and No-Cache are strings and must be enclosed in quotation marks (" "). 如果 CacheControl 将属性设置为与枚举值之一不匹配的值,则 HttpCacheability ArgumentException 会引发。If 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.

CacheControlExpires 和属性已 ExpiresAbsolute 弃用。The CacheControl, Expires, and ExpiresAbsolute properties have been deprecated. 相反,类的方法 HttpCachePolicy 可通过内部对象使用, Cache 以控制 IIS) 输出缓存和客户端缓存 (的 Internet Information Services。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.

适用于