HttpCacheVaryByParams 類別

定義

提供類型安全方式來設定 VaryByParams 屬性。

public ref class HttpCacheVaryByParams sealed
public sealed class HttpCacheVaryByParams
type HttpCacheVaryByParams = class
Public NotInheritable Class HttpCacheVaryByParams
繼承
HttpCacheVaryByParams

範例

下列程式碼範例示範如何 HttpCacheVaryByParamsHttpCachePolicyHttpResponse 相關聯的 物件存取物件。

Response.Cache.SetExpires(DateTime.Now.AddSeconds(60));
Response.Cache.SetCacheability(HttpCacheability.Public);
Response.Cache.SetValidUntilExpires(false);
Response.Cache.VaryByParams["Category"] = true;

if (Response.Cache.VaryByParams["Category"])
{
   //...
}
Response.Cache.SetExpires(DateTime.Now.AddSeconds(60))
Response.Cache.SetCacheability(HttpCacheability.Public)
Response.Cache.SetValidUntilExpires(False)
Response.Cache.VaryByParams("Category") = True

If Response.Cache.VaryByParams("Category") Then
   '...
End If

備註

屬性 VaryByParams 會識別當資源有多個快取回應時,ASP.NET 使用哪些 HTTP GetPost 參數來唯一識別回應的變化。 當回應相依于一組用戶端輸入時,例如標頭或參數時,這非常有用。

HttpCacheVaryByParams與 HTTP 快取控制項標頭不直接相關,但有助於確保用戶端或 Proxy 會因指定的參數而有所不同。 如需 的詳細資訊 VaryByParams ,請參閱 RFC 2616:超文字傳輸通訊協定 -- 可在 World Wide Web Consortium (W3C) 網站上 取得的 HTTP/1.1。 如需完整詳細資料,請參閱第 14 節「標頭欄位定義」。

建構函式

HttpCacheVaryByParams()

初始化 HttpCacheVaryByParams 類別的新執行個體。

屬性

IgnoreParams

取得或設定值,指出 HTTP 回應是否依 GetPost 參數有所不同。

Item[String]

取得或設定值,指出快取是否依據指定的 HTTP 要求參數有所不同。

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetParams()

取得值的陣列,這些值會指定要用來改變快取的 HTTP GETPOST 參數。

GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
SetParams(String[])

設定值的陣列,這些值會指定要用來改變快取的 HTTP GETPOST 參數。

ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於

另請參閱