To |
Do This |
Cache a page's output |
Add the OutputCache directive to the page |
Store multiple versions of a page based on varying query string parameters |
Use the VaryByParam attribute of the OutputCache directive |
Store multiple versions of a page based on varying headers |
Use the VaryByHeader attribute of the OutputCache directive |
Store multiple versions of a page based on varying browsers |
Use the VaryByCustom attribute of the OutputCache directive, selecting “browser” as the value |
Specify the location of the cached content |
Specify the Location attribute in the OutputCache directive |
Access caching attributes programmatically |
Use the Cache property of the Response object, which is an instance of the HttpCachePolicy class |
Offload output caching configuration to the Web.Config file |
Add outputCacheProfile elements to your Web.Config file. Use them as necessary |
Cache a User Control |
Apply the OutputCache directive to the control's ASCX file |