HighTechTalks DotNet Forums  

OutputCache directive vs Response.Cache.SetCacheability

ASP.net Caching microsoft.public.dotnet.framework.aspnet.caching


Discuss OutputCache directive vs Response.Cache.SetCacheability in the ASP.net Caching forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Pete Griffiths
 
Posts: n/a

Default OutputCache directive vs Response.Cache.SetCacheability - 02-16-2006 , 04:47 AM






Hi folks,

I have an infuriating problem. I have a number of pages that I want to cache
server-side only, using varybycustom. I have implemented a
GetVaryByCustomString in my global.asax. I am setting the caching behaviour
in the Page_Load as follows:

Response.Cache.SetCacheability(HttpCacheability.Se rverAndNoCache)
Response.Cache.SetValidUntilExpires(True)

Response.Cache.SetVaryByCustom("report.aspx")

Response.Cache.SetExpires(Info.PageCacheExpires)

(where Info.PageCacheExpires is a specific time for this instance of the
page).

My problem is that this works most of the time, but occasionally it just
stops working - the page is rendered on every request (and the
Global.GetVaryByCustomString stops getting called). The only way to fix this
is to add an OutputCache directive to the page, at which point the caching
works reliably. The problem here though is that the Duration attribute
(which is required) of the directive overrides the value I'm setting in
Response.Cache.SetExpires.

Any thoughts?

(this is asp.net 1.1)

Pete Griffiths



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.