OutputCache Back Button Page Expires

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Johan Nedin (radioboring_at_hotmail.com)
Date: 10/20/04


Date: 20 Oct 2004 03:00:38 -0700

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



Relevant Pages

  • Re: "back" navigation how to?
    ... The FrontPage Back and Next links use Navigation Bars. ... You could investigate opening the cart pages in a new browser window (the ...
    (microsoft.public.frontpage.client)
  • Re: OutputCache Back Button Page Expires
    ... when the user hit back on an aspx page that displayed from a postback, ... browser knows it has to repost the data to get a fresh version of the page. ... > I am having a problem with the @OutputCache page directive and Web ... The cart can be added to (or deleted ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Session State does not end after closing browser
    ... >> David Lozzi ... >>> are the cart items stored in a DB or just in the session? ... If the user loads the shopping cart and then closes all browser ...
    (microsoft.public.inetserver.asp.general)
  • Re: HP Office Jet 7310xi
    ... My relatively new HP Office jet 7310xi gives me the error message ... "REMOVE AND CHECK COLOR CARTRIDGE" all the time as soon as I turn it ... The "Remove and check color cart" issue. ... I would call HP and demand they replace the cart. ...
    (comp.periphs.printers)
  • Re: HP Photosmart says "cartridge(s) in wrong slot"
    ... started giving that error message. ... which lists several errors but not that one. ... This could be a non OEM cart, a low ink ...
    (comp.periphs.printers)