I am using Output cache
on Webpart
in my ASP.Net application.
and using <%@ OutputCache Duration="86400" VaryByParam="None" VaryByCustom="ConferenceID" %>
I notice that webpart contents are coming from cache but my server side code also running that that webpart. Means breakpoint coming to page events even after using output cache.
How I can stop the my server side code should not execute on that webpart after using output cache.
Thanks Dalvir
Output caching on individual elements of a page does not prevent the page-level events from running. This means anything that propegates up/down event wise from the cached content can still end up triggering events on fetching/post-back.
I've most commonly seen this behaviour where people have cached the output of an ASCX, but then have code in the ASPX/parent ASCX's that are then still running and manipulating the ASCX state. Some events will also fire regardless, so it's important you don't do anything heavyweight in places ASP .NET doesnt expect - constructors are a good example of where you shouldnt place data loading code, for pretty much this reason.