473,804 Members | 3,278 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cache VaryByParam problems

Hello there,

I'm using Cache VaryByParam on a page and I'm not getting the
behaviour I expected. Here's what happens:

- I have page a.aspx declared with Cache VaryByParam="na me"
- Page a.aspx has a label in which I set the time the page was
retireved by using DateTime.Now() on the server side (just to what
version of the page I'm getting, and if the cache is working)
- My requests to page a.aspx are generated in other pages, and usually
have more than one query string parameter, but the parameter "name" is
always there. For example,

"http://someserver.com/a.aspx?name=joh n&age=30", or
"http://someserver.com/a.aspx?name=joh n&age=30&city=l isbon" or
"http://someserver.com/a.aspx?city=30& name=john"

What I was expecting is that, when parameter "name" is "john", a.aspx
would be retrieved from the cache regardless of the values of the
other parameters. When the parameter "name" would change to "mary"
then a new version of a.aspx should be retrieved from the server
instead of from cache.

What's happening instead is that the page is ALWAYS retrieved from
cache (I can say that because of the datetime label I have on the
page), regardless of the value of query string parameter "name".

Can anyone tell me what's happening here, please ? Is this a weird
behaviour or am I doing something wrong ? BTW, this is ASP.NET 2.0.

Any help would be greatly appreciated.

Thanks in advance,

Joao Maia
Jul 2 '08 #1
1 1564
Here's some more information regarding this issue:

It appears that the page I mentioned does a redirect to itself and, on
the redirection, sends a completely different set of parameters and
the one named "name" (and defined in VaryByParam) is not included. So
what I think is happening is this:

- a.aspx called with name=john and a bunch of other parameters
- a.aspx does a redirect to itself with some parameters and no "name"
parameter
- the result of the redirection is what actually gets cached
- a.aspx called with name=mary
- a.aspx does another redirect to itself without the "name" parameter
- since there is a cached version of the page for when the "name"
parameter does not exist, this is the one that gets returned and not
the one for mary

Is there any workaround to this issue ? As for why a.aspx redirects to
itself without the same parameters, don't even ask, I can only say
that it has to be like that, it has to do with a workflow engine that
I'm using that calls the pages depending on workflow activities. I'm
not the one actually doing the redirection, the workflow engine is
doing it by itself.

Any help at all would be appreciated.

Thanks in advance,

Joao Maia

On 2 Jul, 12:03, João Maia <jm...@yahoo.co mwrote:
Hello there,

I'm using Cache VaryByParam on a page and I'm not getting the
behaviour I expected. Here's what happens:

- I have page a.aspx declared with Cache VaryByParam="na me"
- Page a.aspx has a label in which I set the time the page was
retireved by using DateTime.Now() on the server side (just to what
version of the page I'm getting, and if the cache is working)
- My requests to page a.aspx are generated in other pages, and usually
have more than one query string parameter, but the parameter "name" is
always there. For example,

"http://someserver.com/a.aspx?name=joh n&age=30", or
"http://someserver.com/a.aspx?name=joh n&age=30&city=l isbon" or
"http://someserver.com/a.aspx?city=30& name=john"

What I was expecting is that, when parameter "name" is "john", a.aspx
would be retrieved from the cache regardless of the values of the
other parameters. When the parameter "name" would change to "mary"
then a new version of a.aspx should be retrieved from the server
instead of from cache.

What's happening instead is that the page is ALWAYS retrieved from
cache (I can say that because of the datetime label I have on the
page), regardless of the value of query string parameter "name".

Can anyone tell me what's happening here, please ? Is this a weird
behaviour or am I doing something wrong ? BTW, this is ASP.NET 2.0.

Any help would be greatly appreciated.

Thanks in advance,

Joao Maia
Jul 2 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2746
by: Tom Kiefer | last post by:
Question: If I have an ASP.NET User Control which defines/exposes a property that the page can use to specify a mode or data subset for the control to use, is there a way to tell the @OutputCache directive to vary its cache based on that property value? I.e., I have: <my:control runat="server" id="mcOne" Flag="One" /> <my:control runat="server" id="mcTwo" Flag="Two" />
7
1520
by: moondaddy | last post by:
I have a products catalogue that I'm putting online and there will be between 20 to 50 different pages of products. Each page contains a datagrid of products for a given category. However, the categories change from time to time so the list of categories must be dynamic and database driven (as is the menu used to select the category to load in the products page). The way I see it there's 2 possible options. dynamically create each aspx...
4
1370
by: A.M | last post by:
Hi, I underestand that I can change a user-control's cache parameters and timeout by attributes like this: <%@ OutputCache Duration="60" VaryByParam="none" %> Is it possible to define Cache parameters inside the c# code ? (during runtime rather than design time)
7
1545
by: A.M | last post by:
Hi, How can I change the duration of user control's cache inside asp.net's C# code? Any help would be apprecited, Alan
7
6597
by: Dmitry Duginov | last post by:
Hi, I have image.aspx that can accept 3 query string parameters (FolderID, ImageID, Size) and it returns full jpg image or image thumbnail (depending on size). I included the following directive: <%@ OutputCache Duration="3600" VaryByParam="FolderID;ImageID;Size" %>
1
2236
by: Edward Wilde | last post by:
Hi, Does anyone know how to examine items in the ASP.NET cache that are added using the OutputCache directive in framework 1.1 i.e. <%@ OutputCache Duration="300" VaryByParam="None" VaryByCustom="cmscontrol,cmsrole"%>
2
1196
by: jack | last post by:
Now here i have a doubt the explorer maintains the cache for 300 seconds when the code is in html code like the one which is below :- <%@ OutputCache Duration="300" VaryByParam="none" %> But the same code when typed in the cs file of the page does not gives the same result. Response.Cache.SetExpires(DateTime.Now.AddSeconds(60));
0
1091
by: SharpSmith | last post by:
hi all i have a strange problem with caching very simple cache test page with fallowing code is not cached at all(browser/server whatever): <%@ Register TagPrefix="uc1" TagName="NewHomePageModule" Src="~/Home/Module/NewHomePageModule.ascx" %> <%@ Page language="c#" %>
3
6461
by: ary | last post by:
I try to create a weblog host site! in this case i can't use cache for every page because that cause to be my Server ram full of caching page. but if I can save cache in hard disk my problem solved? can help me? thanks.
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9579
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10578
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10321
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7620
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6853
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5522
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3820
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.