RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: ASP.NET
Expertise: Intermediate
Oct 2, 2006

Improve Caching Perfomance with the Shared Attribute of the Output Directive

Caching is an important part of Web technology that is often used to improve the Web application performance.

In ASP.NET, each user control is cached separately by default. This creates a significant performance improvement. However, suppose you have an application in which the user control does not vary between pages and the control name is same across the pages.

In such cases, setting the Shared attribute" to true in the Output Directive allows you to have a single cached version of the user control in all the pages, instead of keeping a separate cache for each one of the same user control. You can potentially save a significant amount of memory by enabling the Shared attribute.

The following code shows how the cached user control output is accessed by multiple Web forms pages:

<%@ OutputCache Duration="60" VaryByParam="none" VaryByCustom="browser" Shared="true" %>

MS Sridhar
Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date