D
DV
Has anyone experienced any problems with the use of
Response.Cache.SetVaryByCustom within their code?
I have page which is set to cache the contents for a
certain time (time varies depending on url)
Response.Cache.SetCacheability(HttpCacheability.Server);
Response.Cache.SetExpires((DateTime.Now.AddSeconds
(obj.CacheTimeout)));
Response.Cache.VaryByParams["*"] = true;
And I cache per user via
Response.Cache.SetVaryByCustom("authuser");
This works fine.
BUT if I programmatically decide whether to use the custom
auth or not the cache is cleared for all cached versions
of the page (regardless of the url arguments).
e.g.
if(obj.Confidential)
Response.Cache.SetVaryByCustom("authuser");
e.g. The page I am caching generates a chart and these
charts can be included several times within a page. If
some charts use SetVaryByCustom and some don't then no
caching occurs. If all charts use SetVaryByCustom then all
charts are cached per user.
many thanks,
Darren
Response.Cache.SetVaryByCustom within their code?
I have page which is set to cache the contents for a
certain time (time varies depending on url)
Response.Cache.SetCacheability(HttpCacheability.Server);
Response.Cache.SetExpires((DateTime.Now.AddSeconds
(obj.CacheTimeout)));
Response.Cache.VaryByParams["*"] = true;
And I cache per user via
Response.Cache.SetVaryByCustom("authuser");
This works fine.
BUT if I programmatically decide whether to use the custom
auth or not the cache is cleared for all cached versions
of the page (regardless of the url arguments).
e.g.
if(obj.Confidential)
Response.Cache.SetVaryByCustom("authuser");
e.g. The page I am caching generates a chart and these
charts can be included several times within a page. If
some charts use SetVaryByCustom and some don't then no
caching occurs. If all charts use SetVaryByCustom then all
charts are cached per user.
many thanks,
Darren