Posts

Showing posts from July, 2009

Caching whole page except a user control in ASP.Net application

Approach 1) As described in the following figure, the page is divided into 4 user controls, 3 of them are cached and 1 of the control that you want to load dynamically is not cached. Gotcha: In this approach we have to make sure that we do not add the output cache directive ( <%@ OutputCache Duration="86400" VaryByParam="none" %>) to the page. User control 1 <%@ OutputCache Duration="86400" VaryByParam="none" %> User control 4 (Not Cached) <%@ OutputCache Duration="86400" VaryByParam="none" %> User control 3 <%@ OutputCache Duration="86400" VaryByParam="none" %> User control 4 <%@ OutputCache Duration="86400" VaryByParam="none" %> Approach 2) In this approach you can use server control and add substitution API to call a static method on the page to get dynamic string that wil