Condividi tramite


clientCache Element for staticContent [IIS Settings Schema]

Note

For more information about the clientCache element, see the following topic on the Microsoft IIS.net Web site: Client Cache <clientCache>.

Specifies settings for caching static content that is sent to the client.

Syntax

Attributes and Elements

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

Attributes

Attribute

Description

cacheControlCustom

Optional string attribute.

Specifies custom HTTP 1.1 cache control directives. Multiple directives can be specified if they are separated by carriage return/line feed (CRLF) pairs.

cacheControlMaxAge

Optional timeSpan attribute.

Specifies the maximum age (in seconds) of the cache control value.

The default value is 1.00:00:00 (1 day).

cacheControlMode

Optional enum attribute.

Specifies the mode to use for client caching.

The cacheControlMode attribute can be one of the following possible values.

The default is NoControl.

ValueDescription
NoControlDoes not add a Cache-Control or Expires header to the response. The numeric value is 0.
DisableCacheAdds a Cache-Control: no-cache header to the response. The numeric value is 1.
UseMaxAgeAdds a Cache-Control: max-age=<nnn> header to the response based on the value specified in the CacheControlMaxAge attribute. The numeric value is 2.
UseExpiresAdds an Expires: <date> header to the response based on the date specified in the httpExpires attribute. The numeric value is 3.

httpExpires

Optional string attribute.

Specifies, in Request for Comments (RFC) 1123 format, the date and time after which a page that is cached on the client is considered stale. The value is returned to the browser in the HTML file header. The user agent compares the given value with the current date to determine whether to display a cached page or to request an updated page from the server.

Note

For more information on date and time formats, see RFC 1123, "Requirements for Internet Hosts -- Application and Support." For more information on header fields, see Request for Comments (RFC) 2616, "Hypertext Transfer Protocol -- HTTP/1.1."

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.

staticContent

Configures static file request handler settings.

Remarks

For more information about the clientCache element, see the following topic on the Microsoft IIS.net Web site: Client Cache <clientCache>.

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

mimeMap Element for staticContent [IIS Settings Schema]