Freigeben über


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>

Attributes 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.

Remarks

Default 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.

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

Example

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

<outputCache enableOutputCache="false" />

Element Information

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

See Also

Tasks

How to: Configure Specific Directories Using Location Settings
How to: Lock ASP.NET Configuration Settings

Reference

system.web Element (ASP.NET Settings Schema)
configuration Element (General Settings Schema)
cache Element for caching (ASP.NET Settings Schema)
System.Configuration
System.Web.Configuration

Concepts

ASP.NET Caching Overview
How-to Topics — ASP.NET Caching (Visual Studio)
ASP.NET Configuration File Hierarchy and Inheritance
Securing ASP.NET Configuration
ASP.NET Configuration Scenarios

Other Resources

Getting Started - Enhancing Web Site Performance with Caching
Learning More - Caching
General Configuration Settings (ASP.NET)
ASP.NET Configuration Settings
Configuring ASP.NET Applications
ASP.NET Configuration Files
ASP.NET Configuration API