outputCache Element for caching (ASP.NET Settings Schema) 

Specifies application-wide output cache settings.


<outputCache enableOutputCache="true|false" 
             enableFragmentCache="true|false" 
             sendCacheControlHeader="true|false" 
             omitVaryStar="true|false">
</outputCache>

The following sections describe attributes, child elements, and parent elements.

Attributes

Attribute Description

enableOutputCache

Optional Boolean attribute.

Enables/disables the page output cache.

If disabled, no pages are cached regardless of the programmatic or declarative settings.

Default value is true.

enableFragmentCache

Optional Boolean attribute.

Enables/disables the application fragment cache.

If disabled, no pages are cached regardless of the @ OutputCache directive or caching profile used. Includes a cache-control header indicating that upstream proxy servers as well as browser clients should not attempt to cache page output.

Default value is false.

sendCacheControlHeader

Optional Boolean attribute.

Gets or sets a value indicating whether the cache-control:private header is sent by the output cache module by default.

Default value is false.

omitVaryStar

Optional Boolean attribute.

Enables/disables sending an Http "Vary: *" header in the response. With the default setting of false, a "Vary: *" header is sent for output cached pages.

Default value is false.

Child Elements

None.

Parent Elements

Element Description

configuration

The required root element in every configuration file used by the common language runtime and .NET Framework applications.

system.web

Specifies the root element for the ASP.NET configuration settings in a configuration file. Contains configuration elements that configure ASP.NET Web applications and control how the applications behave.

caching

Configures the cache settings for a Web application.

The following default outputCache element is not explicitly configured in the machine configuration file or in the root Web.config file, but is the default configuration returned by application in the .NET Framework version 2.0.

<outputCache enableOutputCache = "true" 
             enableFragmentCache = "true" 
             sendCacheControlHeader = "true" 
             omitVaryStar = "false">
</outputCache>

The following example disables the output cache for an ASP.NET application.

<outputCache enableOutputCache="false" />

Configuration Section Handler

System.Web.Configuration.OutputCacheSection

Configuration Member

System.Web.Configuration.SystemWebCachingSectionGroup.OutputCache

Configurable Locations

Machine.config

Root level Web.config

Application level Web.config

Requirements

IIS version 5.0, IIS version 5.1, and IIS version 6.0

.NET Framework version 2.0

Visual Studio 2005

Community Additions

ADD
Show: