473,725 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
+ 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 6430
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*********@ho tmail.com> wrote in message
news:2b******** *************** ***@posting.goo gle.com...
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
10171
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 created using information you submitted in a form. This page is no longer available. As a security precaution, Internet Explorer does not automatically resubmit your information for you. To resubmit your information and view this Web page, click the...
29
4001
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. The submit button posts the page back to the server. The button code detects an entry error and sends the page back to the user. This all works. However, if the user presses the Back button at this point, we go back and all the form values are...
4
8163
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 via window.open 3. myFunction() submits the main page's form via document.form.submit() 5. User closes popup window and clicks browser's Back button to return to form entry page 6. All the form data that the user had filled out is now blank...
1
2386
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 <%@ OutputCache Duration="1" Location="None" VaryByParam="none" %>
1
2197
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 browser. I thought the solution is simple enough: Just set the page to expired, maintain no cache and Yo! when user clicks back button browser by default should load fresh copy from server.
5
2161
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 EventArgs) lblOutput.Text = "Welcome, " & Request.Params("id") & " The time now is " & DateTime.Now.ToString("T") End Sub </script>
2
2679
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 problem went away. I put in the outputcache back and the problem is back. I am using forms authentication... and asp.net 2.0. Have you seen this problem before... any help is deeply appreciated.
1
4874
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" VaryByCustom="browser" %> After I added browser... it stopped caching pages.... is there an explanation or... did I observe the problem wrong?
3
3591
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. The search results also allows refining the search and a search button that performs a postback triggers the search. Many of the web pages in the web site have an OutputCache directive and the search results page does not. When I run the first...
0
9401
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...
0
9257
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9174
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,...
0
9111
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8096
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6702
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
4517
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
4782
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.