OutputCacheProfile Clas [IIS 7 and higher]

Configures the output cache profile for the pages of a Web application.

Syntax

class OutputCacheProfile : CollectionElement

Methods

This class contains no methods.

Properties

The following table lists the properties exposed by the OutputCacheProfile class.

Name

Description

Duration

A read/write sint32 value that specifies the time, in seconds, that the page or user control is cached. The default is –1. Setting this attribute on a page or user control establishes an expiration policy for HTTP responses from the page or user control and will automatically cache the page or user control output.

NoteNote:
This property must be defined in either the profile or the @ OutputCache directive of a page that is using the profile.

Enabled

A read/write boolean value. true if caching is enabled for all pages or controls that use this output cache profile; otherwise, false. The default is true.

Location

A read/write sint32 value that specifies the location of the cache. The possible values are listed later in the Remarks section.

Name

A read-only string value that specifies the name of the output cache profile.

NoStore

A read/write boolean value. true if the page issues a Cache-Control: Private no-store header in the HTTP response that directs the browser not to cache the page; otherwise, false. The default is false.

NoteNote:
Setting this attribute to true is equivalent to invoking the HttpCachePolicySetNoStore()()()() method during a Web request.

SqlDependency

A read/write string value that identifies a set of SQL database and table name pairs on which a page or control's output cache depends. When you specify a string for this property, output cached pages can be removed from the cache whenever the SQL table on which they depend changes.

VaryByControl

A read/write string value that specifies a comma-delimited set of IDs of controls to be cached.

NoteNote:
The settings for this property are the same as those of the VaryByControls attribute of the @ OutputCache directive.

VaryByCustom

A read/write comma-delimited string value that represents custom output caching requirements. If you give this property the value of "browser", the cache is varied by browser name and major version information. If you enter a custom string, you must override the GetVaryByCustomString method in the Global.asax file for your application.

NoteNote:
The settings for this property are the same as those of the VaryByCustom attribute of the @ OutputCache directive.

VaryByHeader

A read/write string value that specifies a comma-delimited set of HTTP headers that are associated with the request and are used to vary the cached output.

NoteNote:
The settings for this property are the same as those of the VaryByHeader attribute of the @ OutputCache directive.

VaryByParam

A string value that specifies a comma-delimited set of parameters that vary the cached output by GET query string or form POST parameters.

NoteNote:
The settings for this property are the same as those of the VaryByParam attribute of the @ OutputCache directive.

Subclasses

This class contains no subclasses.

Remarks

Instances of this class are contained in the OutputCacheProfiles array property of the OutputCacheProfileSettings class.

The following table lists the possible values for the Location property.

Value

Keyword

Description

0

Any

The page is cached on the server, all HTTP 1.1 compliant proxies, and the client. This value corresponds to the HttpCacheabilityPublic()()()() enumeration value.

1

Client

The page is cached only on the client where the request originated. This value corresponds to the HttpCacheabilityPrivate()()()() enumeration value.

2

Downstream

The page is cached on any HTTP 1.1 cache-capable devices except the originating server. Cache-capable devices include proxy servers and the client that made the request.

3

Server

The page is cached only on the Web server where the request was processed. This value corresponds to the HttpCacheabilityServer()()()() enumeration value. 

4

None

The page is not cached. This value corresponds to the HttpCacheabilityNoCache()()()() enumeration value.

5

ServerAndClient

The page is cached only on the originating server or on the requesting client. Proxy servers are not allowed to cache the response. This value corresponds to the combination of the HttpCacheabilityPrivate()()()() and HttpCacheabilityServer()()()() enumeration values.

Inheritance Hierarchy

CollectionElement

   OutputCacheProfile

Requirements

Type

Description

Client

Requires IIS 7 on Windows Vista.

Server

Requires IIS 7 on Windows Server 2008.

Product

IIS 7

MOF file

WebAdministration.mof

See Also

Reference

CollectionElement Class [IIS 7 and higher]

OutputCacheSection Class [IIS 7 and higher]

OutputCacheSettingsSection Class [IIS 7 and higher]

OutputCacheProfileSettings Class [IIS 7 and higher]

SqlCacheDependencySection Class [IIS 7 and higher]

HttpCachePolicySetNoStore()()()()

HttpCacheability

OutputCacheLocation

Other Resources

@ OutputCache

Caching Multiple Versions of User Control Output