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.


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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))
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.

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.
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

trouta01Author Commented:
But why is it not consisent, I do not receive the error everytime I use the back button
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.
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).

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial

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.

You should delete all temporary internet files from internet options.
trouta01Author Commented:
I think the issue is an local machine issue, but I am still confused on what is happening.  Thanks for responding.
Lol. The accepted answer was restating what I said in the previous comment. If you read the accepted comment once again
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.