473,473 Members | 2,002 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

OutputCache Back Button Page Expires

Hello!

I am having a problem with the @OutputCache page directive and Web
browser Back Buttons.

Problem:

After setting <%@ OutputCache Location="None" %> on my pages I get the
"Warning! Page has expired" error message, when pushing the Back
Button in my Web browser.

After reading several posts on the subject I found a solution to the
problem.

Solution:

Enable SmartNavigation on the page I am browsing back to. This
solution actually work, which is good.

But I am not completely satisfied. I have worked with smart navigation
before, and smart navigation has a tendency to lead to problems (at
least when I use it...), and my original idea seemed to good to
surender to smart navigation.

Background:

I am implementing a classic Web Shop, and I have the shopping cart
implemented as a UserControl. The cart can be added to (or deleted
from) on different pages in the Shop. If the OutputCache is not set to
Location="None", Page_Load doesn't fire when you push the Back Button
(since the page is cached), and if you have added to the cart and push
back, changes to the cart is not visible to the user (especially if
you switch to a different page) since Page_Load is not fired, and the
cart can't be rebound to reflect the changes to the cart.

(I have developed a framework similar to the UIP Application Block
which works very well and keeps state updated between pages)

I thought the purpose of the Location="None" setting was to trigger
the Page_Load event on the pages, not to trigger a pointless error
message to the user. Pointless beacuse if the user repeatedly push the
back button, the desired page is shown (with cart updated).

Questions:

Is there a way to work around my "problem" without using the
SmartNavigation feature?

And can someone explain why the Location="None" setting isn't working
like I wan't it to, I mean, I think my desired behavior is pretty
straight forward?

Final question: Is there a better way? :)

/ Johan Nedin
Nov 18 '05 #1
1 6400
if you set OutputCache Location="None", you are telling everyone (browser,
proxy server and asp.net) to not cache the page.

when the user hit back on an aspx page that displayed from a postback, the
browser knows it has to repost the data to get a fresh version of the page.
as so many people wrote bad web sites that could not handle this case
(double charge cc cards, double order, etc), the browsers added this
warning. how many sites have you gone to where they say don't click twice or
hit back (these poorly coded sites are the why the browsers had to get
defensive).

so we all have to pay for bad coding practices, sorry.

i would not use smartnav, but if you are tempted, know that it just uses an
iframe to hid the nav history, so you could design your site as a framed
site and hid the nav history.

-- bruce (sqlwork.com)

"Johan Nedin" <ra*********@hotmail.com> wrote in message
news:2b**************************@posting.google.c om...
Hello!

I am having a problem with the @OutputCache page directive and Web
browser Back Buttons.

Problem:

After setting <%@ OutputCache Location="None" %> on my pages I get the
"Warning! Page has expired" error message, when pushing the Back
Button in my Web browser.

After reading several posts on the subject I found a solution to the
problem.

Solution:

Enable SmartNavigation on the page I am browsing back to. This
solution actually work, which is good.

But I am not completely satisfied. I have worked with smart navigation
before, and smart navigation has a tendency to lead to problems (at
least when I use it...), and my original idea seemed to good to
surender to smart navigation.

Background:

I am implementing a classic Web Shop, and I have the shopping cart
implemented as a UserControl. The cart can be added to (or deleted
from) on different pages in the Shop. If the OutputCache is not set to
Location="None", Page_Load doesn't fire when you push the Back Button
(since the page is cached), and if you have added to the cart and push
back, changes to the cart is not visible to the user (especially if
you switch to a different page) since Page_Load is not fired, and the
cart can't be rebound to reflect the changes to the cart.

(I have developed a framework similar to the UIP Application Block
which works very well and keeps state updated between pages)

I thought the purpose of the Location="None" setting was to trigger
the Page_Load event on the pages, not to trigger a pointless error
message to the user. Pointless beacuse if the user repeatedly push the
back button, the desired page is shown (with cart updated).

Questions:

Is there a way to work around my "problem" without using the
SmartNavigation feature?

And can someone explain why the Location="None" setting isn't working
like I wan't it to, I mean, I think my desired behavior is pretty
straight forward?

Final question: Is there a better way? :)

/ Johan Nedin

Nov 18 '05 #2

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

Similar topics

12
by: VB Programmer | last post by:
I know some sites will display the following message if you click on the BACK button in your browser. How do I implement this feature? Warning: Page has Expired The page you requested was...
29
by: Tom wilson | last post by:
I can't believe this is such an impossibility... I have an asp.net page. It accepts data through on form fields and includes a submit button. The page loads up and you fill out some stuff. ...
4
by: jwlum | last post by:
I have the following problem under Internet Explorer only: 1. User fills out form data (myform.php) and clicks a button that fires myFunction() 2. myFunction() spawns a "hello, world" popup page...
1
by: Liming | last post by:
Hi all, A quick question on Cache. I'm not sure what I'm doing wrong. I'm testing out two pages. Page1 and Page2. Page1 click a button, redirect to page 2. on both page, i have <%@...
1
by: nileshsoni21 | last post by:
I have come across a strange behaviour in ASP or rather it could be a HTML or Browser Issue. The browser here is IE. The requirement is to re-load the page whenever user click back button of the...
5
by: Arpan | last post by:
I am using the following code to cache the page output for 60 seconds: <%@ OutputCache Duration="60" VaryByParam="*" %> <script runat="server"> Sub Page_Load(ByVal obj As Object, ByVal ea As...
2
by: Nalaka | last post by:
Hi, I get the following error, I thought at random intervals. Then I realized, that this happens around the time tha page outputCache is set to expire. So I disabled the page output cache and the...
1
by: Nalaka | last post by:
I had ..... <%@ OutputCache Duration="5000" Location="Server" VaryByParam="none" %> Then I added "browser" <%@ OutputCache Duration="5000" Location="Server" VaryByParam="none"...
3
by: =?Utf-8?B?TWlndWVsIElzaWRvcm8=?= | last post by:
Hi, I have an ASP.NET 2.0 application that allows content search. Search is included in all pages and a cross postback to the search results page is performed with the text inserted by the user....
0
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,...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
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.