Try our conversational search powered by Generative AI!

Session cache is being ignored when travelling between pages more than once

Vote:
 

Hi, 

I really hope someone can help with this as I have a day and a half to find a solution.

I have two aspx pages, one of which is a templated page in the CMS, the other just an aspx page in the file system.

Page 1 creates some data and adds it to the session.  Page two takes the data back out of the session and displays it.  The problem is that when you go back a page, change some data on page 1, then resubmit, page 2 ignores the new information.

Am I missing something really obvious?  I'll ensure that page 2 is also a templated page in the CMS in case this in any way is causing the problem.  The weird thing is, when I first created the pages I had the same problem, but it went away for a week on its own, and only came back yesterday.

In a basic webapp in VS2010, I created the same page1 to page 2 logic, and it worked as I expected.  The EPiServer page type seems to break it.

 

In desperation,

Paul

 

#47228
Jan 20, 2011 8:10
Vote:
 

Guess you experience the page cache. Add the session key to the cache parameter in site and problem is solved. When you are logged in the page cache is not used

#47229
Jan 20, 2011 8:35
Vote:
 

Thanks for your quick reply Anders.  Could you be a bit more specific please?  

I'm new to using cache functionality so not entirely sure what this entails.

 

Many thanks.

#47230
Jan 20, 2011 8:59
Vote:
 

Check if it works when you are logged on

If it does, then the page is cached, and you get the result from the cached page.

Then you need to add the session key in httpCacheVaryByParams

<episerver xmlns="http://EPiServer.Configuration.EPiServerSection">

<sites>

<site description="Example Site" siteId="bademiljo.no">

<siteSettings httpCacheVaryByParams="id,epslanguage"

#47231
Jan 20, 2011 9:04
Vote:
 

Hi Anders,

Those parameters are already in the config.

I've added:

Response.Cache.SetCacheability(HttpCacheability.NoCache);

to my second page and now everything works as planned.

 

Thanks very much for your feedback,

Paul

#47236
Jan 20, 2011 10:08
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.