HighTechTalks DotNet Forums  

browser cache interferes with postback

ASP.net Caching microsoft.public.dotnet.framework.aspnet.caching


Discuss browser cache interferes with postback in the ASP.net Caching forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
ajfish@blueyonder.co.uk
 
Posts: n/a

Default browser cache interferes with postback - 05-15-2007 , 09:25 AM






Hi,

In my asp.net 1.1 web application there is a page with a url something
like userinfo.aspx?userid=107 which has some postback buttons on it.

In the GET method (i.e. IsPostBack = false) it fetches some
information about that user and stored it in the session, then in the
postback it uses that information from the session.

However, if the user has the IE browser cache setting at the default
value ("check for new versions of stored pages automatically"),
sometimes IE will use the cached page instead of sending the GET. this
means that when it sends the postback, the wrong information is in the
session.

from what I can tell, the best way to solve this is to put cache-
control directives in, so that the page doesn't get cached. I would
like to do this for every page in the application. is there a way to
specify in the web.config that all aspx pages should be sent with "no
cache" direcives?

it seems to me that most asp.net applications would suffer from the
same problem are there any best practice techniques to avoid this
(except not using session state)

TIA

Andy


Reply With Quote
  #2  
Old   
Teemu Keiski
 
Posts: n/a

Default Re: browser cache interferes with postback - 05-17-2007 , 03:54 AM






With v2.0 I think you could set it on web.config
(http://msdn2.microsoft.com/en-us/library/ms228124.aspx) but in v1.x you
certainly can do it programmatically in Application_BeginRequest event
handler (global.asax)


--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net




<ajfish (AT) blueyonder (DOT) co.uk> wrote

Quote:
Hi,

In my asp.net 1.1 web application there is a page with a url something
like userinfo.aspx?userid=107 which has some postback buttons on it.

In the GET method (i.e. IsPostBack = false) it fetches some
information about that user and stored it in the session, then in the
postback it uses that information from the session.

However, if the user has the IE browser cache setting at the default
value ("check for new versions of stored pages automatically"),
sometimes IE will use the cached page instead of sending the GET. this
means that when it sends the postback, the wrong information is in the
session.

from what I can tell, the best way to solve this is to put cache-
control directives in, so that the page doesn't get cached. I would
like to do this for every page in the application. is there a way to
specify in the web.config that all aspx pages should be sent with "no
cache" direcives?

it seems to me that most asp.net applications would suffer from the
same problem are there any best practice techniques to avoid this
(except not using session state)

TIA

Andy



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.