HighTechTalks DotNet Forums  

Back Button Problem

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


Discuss Back Button Problem in the ASP.net Caching forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Davey P
 
Posts: n/a

Default Back Button Problem - 06-27-2005 , 10:01 AM






I have 2 pages to my application. The first page is a selection page, and
this determines what data is displayed on the second page. The second page
contains a datagrid, which is constantly needing to post back to the server
to update information. I have seen numerous ways of disabling caching, such
as:

Response.Cache.SetCacheability(HttpCacheability.No Cache);

or

Response.Buffer = true;
Response.ExpiresAbsolute = DateTime.Now.Subtract(new TimeSpan(1,0,0,0));
Response.Expires = 0;
Response.CacheControl = "no-cache";

They prevent a cached page from being shown when back is clicked, but
instead the page expired screen is displayed. So if my second page has posted
back 10 times to update data, you'll see the page expired screen on each
click of the back button up to the count of 10, before finally displaying my
initial selection screen. I require that when back is clicked the page goes
straight back to the initial selection screen. Any ideas?

Reply With Quote
  #2  
Old   
Stefan [MSFT]
 
Posts: n/a

Default Re: Back Button Problem - 06-27-2005 , 10:10 AM






Hi Dave,

that is not a MCMS problem.
Personally I don't think that there is a solution for this - my favorite
online banking solution behaves the same.

Rather than using a back button you should provide a back link on your page
that redirects to the desired page and teach your users not to use the back
button.

If you need to follow up on this you should post to an Internet Explorer
related newsgroup as this is an IE problem.

Cheers,
Stefan

--
This posting is provided "AS IS" with no warranties, and confers no rights

New to MCMS?
Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
----------------------


"Davey P" <DaveyP (AT) discussions (DOT) microsoft.com> wrote

Quote:
I have 2 pages to my application. The first page is a selection page, and
this determines what data is displayed on the second page. The second page
contains a datagrid, which is constantly needing to post back to the
server
to update information. I have seen numerous ways of disabling caching,
such
as:

Response.Cache.SetCacheability(HttpCacheability.No Cache);

or

Response.Buffer = true;
Response.ExpiresAbsolute = DateTime.Now.Subtract(new TimeSpan(1,0,0,0));
Response.Expires = 0;
Response.CacheControl = "no-cache";

They prevent a cached page from being shown when back is clicked, but
instead the page expired screen is displayed. So if my second page has
posted
back 10 times to update data, you'll see the page expired screen on each
click of the back button up to the count of 10, before finally displaying
my
initial selection screen. I require that when back is clicked the page
goes
straight back to the initial selection screen. Any ideas?



Reply With Quote
  #3  
Old   
Joerg Jooss
 
Posts: n/a

Default Re: Back Button Problem - 07-01-2005 , 03:41 AM



Davey P wrote:

Quote:
I have 2 pages to my application. The first page is a selection page,
and this determines what data is displayed on the second page. The
second page contains a datagrid, which is constantly needing to post
back to the server to update information. I have seen numerous ways
of disabling caching, such as:

Response.Cache.SetCacheability(HttpCacheability.No Cache);

or

Response.Buffer = true;
Response.ExpiresAbsolute = DateTime.Now.Subtract(new
TimeSpan(1,0,0,0)); Response.Expires = 0;
Response.CacheControl = "no-cache";

They prevent a cached page from being shown when back is clicked, but
instead the page expired screen is displayed. So if my second page
has posted back 10 times to update data, you'll see the page expired
screen on each click of the back button up to the count of 10, before
finally displaying my initial selection screen. I require that when
back is clicked the page goes straight back to the initial selection
screen. Any ideas?
This warning is browser specific but significant, since you're actually
resending the POST request -- which usually means it it processed a
second time on the serverside.

In order to avoid repeating the POST request, you'll have to use the
Redirect-After-Post pattern. This means that the page that processes
the POST request should redirect (using HttpResponse.Redirect()) to
itself or any other desired page once processing is finished.

So instead of
Form.aspx --POST/200 OK--> Form.aspx

you'll have
Form.aspx --POST/302 Moved Temporarily--> GET/200 OK -->Form.aspx

The browser will only record the last GET request in its history, which
poses no problem when using the back button.


Cheers,
--
http://www.joergjooss.de
mailto:news-reply (AT) joergjooss (DOT) de


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.