Export (0) Print
Expand All

Page.InitOutputCache Method

Initializes the output cache for the current page request.

[Visual Basic]
Protected Overridable Sub InitOutputCache( _
   ByVal duration As Integer, _
   ByVal varyByHeader As String, _
   ByVal varyByCustom As String, _
   ByVal location As OutputCacheLocation, _
   ByVal varyByParam As String _
)
[C#]
protected virtual void InitOutputCache(
 int duration,
 string varyByHeader,
 string varyByCustom,
 OutputCacheLocation location,
 string varyByParam
);
[C++]
protected: virtual void InitOutputCache(
 int duration,
 String* varyByHeader,
 String* varyByCustom,
 OutputCacheLocation location,
 String* varyByParam
);
[JScript]
protected function InitOutputCache(
   duration : int,
 varyByHeader : String,
 varyByCustom : String,
 location : OutputCacheLocation,
 varyByParam : String
);

Parameters

duration
The amount of time that objects stored in the output cache are valid.
varyByHeader
A semicolon-separated list of headers that content from the output cache will vary by.
varyByCustom
The Vary HTTP header.
location
One of the OutputCacheLocation values.
varyByParam
A semicolon-separated list of parameters, received by a GET or POST method, that content from the output cache will vary by.

Exceptions

Exception Type Condition
ArgumentOutOfRangeException An invalid value is specified for the output cache location.

Remarks

You should not call this method. To enable and manipulate output caching for a page, use either the @ OutputCache directive in the .aspx file, or the methods and properties of the HttpCachePolicy class. The latter are accessible through Response.Cache syntax in the page's code-declaration block or code-behind file. For more information, see Caching ASP.NET Pages.

Requirements

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

Page Class | Page Members | System.Web.UI Namespace | @ OutputCache | Caching ASP.NET Pages | HttpCachePolicy

Show:
© 2014 Microsoft