P
Pete Griffiths
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.ServerAndNoCache)
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
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.ServerAndNoCache)
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