Sunday, July 13, 2008

ASP.NET OutputCache on a user control

When using ASP.NET output caching on a user control, it is usually a good idea to set the Shared attribute to true and refer to the control with the same ID as this makes best use of the cache.

The default behavior of the output cache is with Shared set to false i.e. the cache isn't shared among multiple pages for the control.

Also, with output caching for user controls, the Location attribute is not supported because the controls have to be rendered on the ASP.NET web server.

EDIT: This is also called fragment caching.

No comments: