[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2668
  • Last Modified:

error: "Warning: Page has Expired" occurring occasionally

I have a query app that has a page where there is one page(query.aspx) contains a criteria screen and the query results and another screen(report.aspx) shows the report on an invidiual case that can be reached by clicking an item in the query results panel.

There can be many postbacks to the query.aspx page, and I use Response.Redirect to get to the report.aspx page.  I aslo provide naviagation buttons that mean the back is not required, put some users are using it anyway.  

The problem is that once in a while when I use the back button, I will receive the error "Warning: Page has Expired" ... use the refresh button.  I am having a hard time reproducing this error.  I am pretty sure I ruled out time duration as the cause.

Is there a remedy so that the page does not expire, or could someone tell me what the condition is for getting this error message.

Thanks

0
trouta01
Asked:
trouta01
  • 3
  • 3
  • 2
  • +1
1 Solution
 
hismightinessCommented:
Because you are submitting a form to produce your query results, this causes the behaviour you described (by design).  A way you can work around this is by using the viewstate:

                ViewState("UrlReferrer") = Request.UrlReferrer.ToString()

Insert that into your page load event (normally within a "If Not Page.IsPostBack") and then refer to it within a back button/link click event:

                Response.Redirect(CType(ViewState("UrlReferrer"), String))
0
 
trouta01Author Commented:
The problem does not happen when the users use the buttons provided on the webpage.  It only occurs when they use the "back" button on the browser.  I don't think there is an event for the "back" button click.

0
 
hismightinessCommented:
Well, the behavior is built-in by design except for when nothing is cached.  I suspect that if you turn off Viewstate & Caching for the page, it will not happen.  However, you will lose some functionality.  The alternative would be to control the browser environment by opening the site in a new window without buttons and disable the Alt+BackArrow hot keys.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
trouta01Author Commented:
But why is it not consisent, I do not receive the error everytime I use the back button
0
 
ryerrasCommented:
This is a common problem with the webpages that use post method
this error means --> the data has expired, and must be re-posted.

if you can not use GET method, then you must re-post the data.

when you are clicking the  "Back" button on the page, when you click, you are reposting the form data to the previous screen.
0
 
hismightinessCommented:
Well said, ryerras.  

Basically, when you try to go "back" to any web page where form data has been submitted to (post method) this will usually happen (not necessarily the form page itself - except in .Net).
0
 
khareatulCommented:
Hi

Actually that happens when you submit a form that is using the POST  method. The POST method is supposed to be used when data is changed, thus expiring the previous view. If you submit the form then hit back on your browser you will get that warning. it has nothing to do with secure sites.
Microsoft has a workaround for it using IFRAMES, that is part of ASP.Net, called "Smart Navigation".
you can redirect the user to the page again (while maintaining the querystring) to avoid this.
e.g.:
Response.Redirect(Request.Url.PathAndQuery);

You should delete all temporary internet files from internet options.
0
 
trouta01Author Commented:
I think the issue is an local machine issue, but I am still confused on what is happening.  Thanks for responding.
0
 
ryerrasCommented:
Lol. The accepted answer was restating what I said in the previous comment. If you read the accepted comment once again
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now