Edit

Share via


OutputCacheProfile Class

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. Note: 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. Note: Setting this attribute to true is equivalent to invoking the System.Web.HttpCachePolicy.SetNoStore 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. Note: 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. Note: 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. Note: 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. Note: 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 System.Web.HttpCacheability.Public enumeration value.
1 Client The page is cached only on the client where the request originated. This value corresponds to the System.Web.HttpCacheability.Private 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 System.Web.HttpCacheability.Server enumeration value.
4 None The page is not cached. This value corresponds to the System.Web.HttpCacheability.NoCache 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 System.Web.HttpCacheability.Private and System.Web.HttpCacheability.Server enumeration values.

Inheritance Hierarchy

CollectionElement

OutputCacheProfile

Requirements

Type Description
Client - IIS 7.0 on Windows Vista
- IIS 7.5 on Windows 7
- IIS 8.0 on Windows 8
- IIS 10.0 on Windows 10
Server - IIS 7.0 on Windows Server 2008
- IIS 7.5 on Windows Server 2008 R2
- IIS 8.0 on Windows Server 2012
- IIS 8.5 on Windows Server 2012 R2
- IIS 10.0 on Windows Server 2016
Product - IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0
MOF file WebAdministration.mof

See Also

System.Web.HttpCachePolicy.SetNoStore System.Web.HttpCacheability System.Web.UI.OutputCacheLocation
CollectionElement Class
OutputCacheSection Class
OutputCacheSettingsSection Class
OutputCacheProfileSettings Class
SqlCacheDependencySection Class
@ OutputCache
Caching Multiple Versions of User Control Output