asp.net.ph

Skip Navigation Links

<caching> outputCache Element

ASP.NET Syntax   ASP.NET Configuration Sections


Specifies application-wide output cache settings.configuration Element (General Settings Schema)
  system.web Element (ASP.NET Settings Schema)
    caching Element (ASP.NET Settings Schema)
      outputCache Element for caching (ASP.NET Settings Schema)

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

Collapse imageAttributes and Elements

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.

Collapse imageRemarks

Collapse imageDefault Configuration

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.

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

Collapse imageExample

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

  CopyCode imageCopy Code
<outputCache enableOutputCache="false" />
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.
  CopyCode imageCopy Code
<outputCache enableOutputCache = "true" 
             enableFragmentCache = "true" 
             sendCacheControlHeader = "true" 
             omitVaryStar = "false">
</outputCache>

Collapse imageExample

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

  CopyCode imageCopy Code
<outputCache enableOutputCache="false" />
See Also

<caching> Section   cache Element   outputCacheSettings Element   sqlCacheDependency Element   OutputCacheSection Class



© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note