add Element for profiles for caching [IIS Settings Schema]

Note

For more information about the add element, see the following topic on the Microsoft IIS.net Web site: Adding Caching Profiles <add>.

Adds an output caching profile to the collection of output caching profiles.

Syntax

Attributes and Elements

The following sections describe attributes, child elements, and parent elements for this section.

Attributes

Attribute

Description

duration

Optional timeSpan attribute.

Specifies the time (in seconds) that the page or user control is cached

The default is 00:00:30.

extension

Required string attribute.

Specifies the file type extension for the files you want to cache.

kernelCachePolicy

Optional enum attribute.

Configures the kernel caching policy.

The kernelCachePolicy attribute can be one of the following values. The default is DontCache.

Value Description
DontCache Content is not cached. The numeric value is 0.
CacheUntilChange Content is only cached until the content changes. The numeric value is 1.
CacheForTimePeriod Content is cached for the length of time specified by the duration attribute. The numeric value is 2.
DisableCache The cache is disabled and no caching will occur. The numeric value is 3

location

Optional enum attribute.

Specifies the valid values for controlling the location of the output-cached HTTP response for a resource.

The location attribute can be one of the following possible values. The default is Server.

Value Description
Any The output cache can be located on the browser client (where the request originated), on a proxy server (or any other server) participating in the request, or on the server where the request was processed. The numeric value is 0.
Client The output cache is located on the browser client where the request originated. The numeric value is 1.
Downstream The output cache can be stored in any HTTP 1.1 cache-capable devices other than the origin server. This includes proxy servers and the client that made the request. The numeric value is 2.
Server The output cache is located on the Web server where the request was processed. The numeric value is 3.
None The output cache is disabled for the requested page. The numeric value is 4.
ServerAndClient The output cache can be stored only at the origin server or at the requesting client. Proxy servers are not allowed to cache the response. The numeric value is 5.

policy

Optional enum attribute.

Configures the output caching policy.

The policy attribute can be one of the following possible values. The default is DontCache.

Value Description
DontCache Content is not cached. The numeric value is 0.
CacheUntilChange Content is only cached until the content changes. The numeric value is 1.
CacheForTimePeriod Content is cached for the length of time specified by the duration attribute. The numeric value is 2.
DisableCache The cache is disabled and no caching will occur. The numeric value is 3

varyByHeaders

Optional string attribute.

Specifies a semicolon-separated list of HTTP headers used to vary the output cache. When this attribute is set to multiple headers, the output cache contains a different version of the requested document for each combination of specified headers.

varyByQueryString

Optional string attribute.

Specifies a semicolon-separated list of strings used to vary the output cache. By default, these strings correspond to a query string value sent with GET method attributes, or a parameter sent by using the POST method. When this attribute is set to multiple parameters, the output cache contains a different version of the requested document for each combination of specified parameters. Possible values include none, an asterisk (*), and any valid query string or POST parameter name.

Child Elements

None

Parent Elements

Element

Description

configuration

Specifies the root element in every configuration file that is used by IIS 7.

system.webServer

Specifies the top-level section group (in ApplicationHost.config) in which this element is defined.

caching

Configures output cache settings.

profiles

Configures the profile to use for output caching.

Remarks

For more information about the add element, see the following topic on the Microsoft IIS.net Web site: Adding Caching Profiles <add>.

Element Information

Configuration locations

Machine.config

ApplicationHost.config

Root application Web.config

Application Web.config

Directory Web.config

Requirements

Microsoft Internet Information Services (IIS) version 7.0

See Also

Reference

clear Element for profiles for caching [IIS Settings Schema]

remove Element for profiles for caching [IIS Settings Schema]