Share via


HttpResponse.CacheControl 屬性

定義

取得或設定符合其中一個 HttpCacheability 列舉值的 Cache-Control HTTP 標頭。

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 列舉值。

例外狀況

設定的字串值不符合其中一個 HttpCacheability 列舉值。

備註

PublicNo-Cache 的值 Private 是字串,必須以引號括住 (「) 。 CacheControl如果 屬性設定為不符合其中 HttpCacheability 一個列舉值的值,則會 ArgumentException 擲回 。 CacheControl如果未設定 屬性,回應的快取性會設定為 NoCache

CacheControlExpiresExpiresAbsolute 屬性已被取代。 相反地 HttpCachePolicy ,類別的方法可透過 Cache 內建物件取得,以控制Internet Information Services (IIS) 輸出快取和用戶端快取。

適用於