Export (0) Print
Expand All

HttpCachePolicy Class

Contains methods for setting cache-specific HTTP headers and for controlling the ASP.NET page output cache.

System.Object
  System.Web.HttpCachePolicy

Namespace:  System.Web
Assembly:  System.Web (in System.Web.dll)

public sealed class HttpCachePolicy

The HttpCachePolicy type exposes the following members.

  NameDescription
Public propertyVaryByContentEncodingsGets the list of Content-Encoding headers that will be used to vary the output cache.
Public propertyVaryByHeadersGets the list of all HTTP headers that will be used to vary cache output.
Public propertyVaryByParamsGets the list of parameters received by an HTTP GET or HTTP POST that affect caching.
Top

  NameDescription
Public methodAddValidationCallbackRegisters a validation callback for the current response.
Public methodAppendCacheExtensionAppends the specified text to the Cache-Control HTTP header.
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodSetAllowResponseInBrowserHistoryMakes the response is available in the client browser History cache, regardless of the HttpCacheability setting made on the server, when the allow parameter is true.
Public methodSetCacheability(HttpCacheability)Sets the Cache-Control header to one of the values of HttpCacheability.
Public methodSetCacheability(HttpCacheability, String)Sets the Cache-Control header to one of the values of HttpCacheability and appends an extension to the directive.
Public methodSetETagSets the ETag HTTP header to the specified string.
Public methodSetETagFromFileDependenciesSets the ETag HTTP header based on the time stamps of the handler's file dependencies.
Public methodSetExpiresSets the Expires HTTP header to an absolute date and time.
Public methodSetLastModifiedSets the Last-Modified HTTP header to the DateTime value supplied.
Public methodSetLastModifiedFromFileDependenciesSets the Last-Modified HTTP header based on the time stamps of the handler's file dependencies.
Public methodSetMaxAgeSets the Cache-Control: max-age HTTP header based on the specified time span.
Public methodSetNoServerCachingStops all origin-server caching for the current response.
Public methodSetNoStoreSets the Cache-Control: no-store HTTP header.
Public methodSetNoTransformsSets the Cache-Control: no-transform HTTP header.
Public methodSetOmitVaryStarSpecifies whether the response should contain the vary:* header when varying by parameters.
Public methodSetProxyMaxAgeSets the Cache-Control: s-maxage HTTP header based on the specified time span.
Public methodSetRevalidationSets the Cache-Control HTTP header to either the must-revalidate or the proxy-revalidate directives based on the supplied enumeration value.
Public methodSetSlidingExpirationSets cache expiration to from absolute to sliding.
Public methodSetValidUntilExpiresSpecifies whether the ASP.NET cache should ignore HTTP Cache-Control headers sent by the client that invalidate the cache.
Public methodSetVaryByCustomSpecifies a custom text string to vary cached output responses by.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

For background information about HTTP headers and controlling caching, see RFC 2616: Hypertext Transfer Protocol -- HTTP/1.1, available on the World Wide Web Consortium (W3C) Web site.

TopicLocation
How to: Cache Versions of a Page Using HTTP HeadersBuilding ASP .NET Web Applications
How to: Set the Cacheability of an ASP.NET Page DeclarativelyBuilding ASP .NET Web Applications
How to: Set a Page's Cacheability ProgrammaticallyBuilding ASP .NET Web Applications
How to: Cache Page Output with File DependenciesBuilding ASP .NET Web Applications
How to: Cache Versions of a Page Using Requesting BrowserBuilding ASP .NET Web Applications
How to: Set Expiration Values for ASP.NET Page CachingBuilding ASP .NET Web Applications
How to: Cache Page Output with Cache Key DependenciesBuilding ASP .NET Web Applications
How to: Retrieve Values of Cached ItemsBuilding ASP .NET Web Applications
How to: Cache Versions of a Page Using HTTP HeadersBuilding ASP .NET Web Applications
How to: Set the Cacheability of an ASP.NET Page DeclarativelyBuilding ASP .NET Web Applications
How to: Set a Page's Cacheability ProgrammaticallyBuilding ASP .NET Web Applications
How to: Cache Page Output with File DependenciesBuilding ASP .NET Web Applications
How to: Cache Versions of a Page Using Requesting BrowserBuilding ASP .NET Web Applications
How to: Set Expiration Values for ASP.NET Page CachingBuilding ASP .NET Web Applications
How to: Cache Page Output with Cache Key DependenciesBuilding ASP .NET Web Applications
How to: Retrieve Values of Cached ItemsBuilding ASP .NET Web Applications
Walkthrough: Using Output Caching to Enhance Web Site PerformanceBuilding ASP .NET Web Applications in Visual Studio

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft