HttpCachePolicyBase 類別

定義

作為類別的基底類別,這些類別包含設定快取特定 HTTP 標頭以及控制 ASP.NET 頁面輸出快取的方法。Serves as the base class for classes that contain methods for setting cache-specific HTTP headers and for controlling the ASP.NET page output cache.

public ref class HttpCachePolicyBase abstract
public abstract class HttpCachePolicyBase
type HttpCachePolicyBase = class
Public MustInherit Class HttpCachePolicyBase
繼承
HttpCachePolicyBase
衍生

備註

HttpCachePolicyBase類別是抽象類別,其包含與類別相同的成員 HttpCachePolicyThe HttpCachePolicyBase class is an abstract class that contains the same members as the HttpCachePolicy class. HttpCachePolicyBase類別可讓您建立類似類別的衍生類別 HttpCachePolicy ,但您可以自訂,也可以在 ASP.NET 管線之外進行自訂作業。The HttpCachePolicyBase class lets you create derived classes that are like the HttpCachePolicy class, but that you can customize and that work outside the ASP.NET pipeline. 當您執行單元測試時,您通常會使用衍生類別來執行自訂行為的成員,以滿足您正在測試的案例。When you perform unit testing, you typically use a derived class to implement members with customized behavior that fulfills the scenario you are testing.

HttpCachePolicyWrapper 類別衍生自 HttpCachePolicyBase 類別。The HttpCachePolicyWrapper class derives from the HttpCachePolicyBase class. 類別可做為類別的包裝函式 HttpCachePolicyWrapper HttpCachePolicyThe HttpCachePolicyWrapper class serves as a wrapper for the HttpCachePolicy class. 在執行時間,您通常會使用類別的實例 HttpCachePolicyWrapper 來呼叫物件的成員 HttpCachePolicyAt run time, you typically use an instance of the HttpCachePolicyWrapper class to call members of the HttpCachePolicy object.

建構函式

HttpCachePolicyBase()

初始化這個類別,以供繼承的類別執行個體使用。Initializes the class for use by an inherited class instance. 這個建構函式只能由繼承的類別呼叫。This constructor can only be called by an inherited class.

屬性

VaryByContentEncodings

在衍生類別中覆寫時,取得用來變更輸出快取的 Content-Encoding 標頭清單。When overridden in a derived class, gets the list of Content-Encoding headers that are used to vary the output cache.

VaryByHeaders

在衍生類別中被覆寫時,取得用來區分快取輸出的所有 HTTP 標頭的清單。When overridden in a derived class, gets the list of all HTTP headers that are used to vary cache output.

VaryByParams

在衍生類別中覆寫時,取得由 HTTP GETPOST 動詞命令接收之影響快取的參數清單。When overridden in a derived class, gets the list of parameters that are received by an HTTP GET or POST verb that affect caching.

方法

AddValidationCallback(HttpCacheValidateHandler, Object)

在衍生類別中覆寫時,註冊目前回應的驗證回呼。When overridden in a derived class, registers a validation callback for the current response.

AppendCacheExtension(String)

在衍生類型中覆寫時,請將指定的文字附加到 Cache-Control HTTP 標頭。When overridden in a derived class, appends the specified text to the Cache-Control HTTP header.

Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(繼承來源 Object)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)
SetAllowResponseInBrowserHistory(Boolean)

在衍生類別中覆寫時,讓回應適用於瀏覽器歷程記錄快取,不論伺服器上所進行的 HttpCacheability 設定為何。When overridden in a derived class, makes the response available in the browser history cache, regardless of the HttpCacheability setting made on the server.

SetCacheability(HttpCacheability)

在衍生類別中覆寫時,將 Cache-Control 標頭設定為指定的 HttpCacheability 值。When overridden in a derived class, sets the Cache-Control header to the specified HttpCacheability value.

SetCacheability(HttpCacheability, String)

在衍生類別中覆寫時,將 Cache-Control 標頭設定為指定的 HttpCacheability 值,並將擴充功能附加至指示詞。When overridden in a derived class, sets the Cache-Control header to the specified HttpCacheability value and appends an extension to the directive.

SetETag(String)

在衍生類別中覆寫時,將 ETag HTTP 標頭設定為指定的字串。When overridden in a derived class, sets the ETag HTTP header to the specified string.

SetETagFromFileDependencies()

在衍生類別中覆寫時,根據處理常式檔案相依性的時間戳記,設定 ETag HTTP 標頭。When overridden in a derived class, sets the ETag HTTP header based on the time stamps of the handler's file dependencies.

SetExpires(DateTime)

在衍生類型中覆寫時,將 Expires HTTP 標頭設定為絕對日期和時間。When overridden in a derived class, sets the Expires HTTP header to an absolute date and time.

SetLastModified(DateTime)

在衍生類型中遭覆寫時,請將 Last-ModifiedHTTP 標頭設定為指定的日期與時間。When overridden in a derived class, sets the Last-Modified HTTP header to the specified date and time.

SetLastModifiedFromFileDependencies()

在衍生類別中覆寫時,根據處理常式檔案相依性的時間戳記,設定 Last-Modified HTTP 標頭。When overridden in a derived class, sets the Last-Modified HTTP header based on the time stamps of the handler's file dependencies.

SetMaxAge(TimeSpan)

在衍生類別中覆寫時,請將 Cache-Control: max-age HTTP 標頭設定為指定的時間範圍。When overridden in a derived class, sets the Cache-Control: max-age HTTP header to the specified time span.

SetNoServerCaching()

在衍生類別中覆寫時,會停止所有原始伺服器對目前回應快取。When overridden in a derived class, stops all origin-server caching for the current response.

SetNoStore()

在衍生類型中覆寫時,設定 Cache-Control: no-store HTTP 標頭。When overridden in a derived class, sets the Cache-Control: no-store HTTP header.

SetNoTransforms()

在衍生類型中覆寫時,設定 Cache-Control: no-transform HTTP 標頭。When overridden in a derived class, sets the Cache-Control: no-transform HTTP header.

SetOmitVaryStar(Boolean)

在衍生類別中覆寫時,指定快取依參數而有所不同時,回應是否包含 vary: 標頭。When overridden in a derived class, specifies whether the response contains the vary: header when caching varies by parameters.

SetProxyMaxAge(TimeSpan)

在衍生類別中覆寫時,請將 Cache-Control: s-maxage HTTP 標頭設定為指定的時間範圍。When overridden in a derived class, sets the Cache-Control: s-maxage HTTP header to the specified time span.

SetRevalidation(HttpCacheRevalidation)

在衍生類別中覆寫時,會根據指定的列舉值,將 Cache-Control HTTP 標頭設定為 must-revalidateproxy-revalidate 指示詞。When overridden in a derived class, sets the Cache-Control HTTP header to either the must-revalidate or the proxy-revalidate directives, based on the specified enumeration value.

SetSlidingExpiration(Boolean)

在衍生類別中執行覆寫時,將快取期限設定為絕對或滑動。When overridden in a derived class, sets cache expiration to absolute or sliding.

SetValidUntilExpires(Boolean)

在衍生類別中覆寫時,指定 ASP.NET 快取是否應忽略使此快取無效之用戶端傳送的 HTTP Cache-Control 標頭。When overridden in a derived class, specifies whether the ASP.NET cache should ignore HTTP Cache-Control headers that are sent by the client that invalidate the cache.

SetVaryByCustom(String)

在衍生類別中覆寫時,指定用來區分快取輸出回應的文字字串。When overridden in a derived class, specifies a text string to vary cached output responses by.

ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)

適用於