[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.caching

Response.Cache.VaryByParams[] is being ignored?

DC

2/8/2007 3:21:00 PM

Hi,

in the codebehind of an .aspx, I am doing the following (in
Page_Load):

int cacheDuration = 10;
TimeSpan cacheSpan = new TimeSpan(0, 0, cacheDuration);
DateTime now = DateTime.Now;
Response.Cache.VaryByParams.IgnoreParams = false;
Response.Cache.VaryByParams["parm1;parm2"] = true;
Response.Cache.SetLastModified(now);
Response.Cache.SetExpires(now.Add(cacheSpan));
Response.Cache.SetMaxAge(cacheSpan);
Response.Cache.SetCacheability(HttpCacheability.Public);
Response.Cache.SetValidUntilExpires(true);

Caching works, but if I add alternating values to URL parameters
(parm1 + parm2) the page will still be refreshed every 10 seconds,
regardless of what the parameters contain.

TIA for any hint on what could be the reason for this.

Regards
DC

1 Answer

DC

2/8/2007 3:33:00 PM

0

I forgot to mention: I am still using Framework 1.1 - for just a
little more time

On Feb 8, 4:21 pm, "DC" <d...@upsize.de> wrote:
> Hi,
>
> in the codebehind of an .aspx, I am doing the following (in
> Page_Load):
>
> int cacheDuration = 10;
> TimeSpan cacheSpan = new TimeSpan(0, 0, cacheDuration);
> DateTime now = DateTime.Now;
> Response.Cache.VaryByParams.IgnoreParams = false;
> Response.Cache.VaryByParams["parm1;parm2"] = true;
> Response.Cache.SetLastModified(now);
> Response.Cache.SetExpires(now.Add(cacheSpan));
> Response.Cache.SetMaxAge(cacheSpan);
> Response.Cache.SetCacheability(HttpCacheability.Public);
> Response.Cache.SetValidUntilExpires(true);
>
> Caching works, but if I add alternating values to URL parameters
> (parm1 + parm2) the page will still be refreshed every 10 seconds,
> regardless of what the parameters contain.
>
> TIA for any hint on what could be the reason for this.
>
> Regards
> DC