devxlogo

Improve Caching Perfomance with the Shared Attribute of the Output Directive

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:

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist