Question: How can I "expire" a web page (prevent BACK button)

  • Thread starter Thread starter VB Programmer
  • Start date Start date
V

VB Programmer

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 Refresh
button.
 
Thanks. In the Page_Load even I tried both:

Response.Cache.SetCacheability(HttpCacheability.ServerAndNoCache)
and
Response.Cache.SetCacheability(HttpCacheability.NoCache )

But, I can still hit the BACK button and see the page. Ideas?
 
could it be caching on a proxy ... in the old asp world we would do the
following:

Response.Expires = -1

Response.AddHeader "Pragma", "No-Cache"

Response.CacheControl = "no-cache"
 
Thanks. I've tried...

Response.Expires=-1

also...

Response.Cache.SetExpires(DateTime.Now.AddSeconds(0))
Response.Cache.SetCacheability(HttpCacheability.NoCache)

It still let's me go "BACK" to the form. Any ideas?
 
I know this does basically one way or another what you are going for, but it
should force a refresh to the server.

bill

<meta http-equiv="expires" content="Sun, Dec 31 1970 12:00:00 GMT" />
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="pragma" content="no-cache" />
 
Thanks.

Tried that also. It didn't work. Any more ideas?

Any links to samples, etc..?
 
That page about resubmitting you're talking about does not come from the
server. It is shown by IE and you will see if when you come back to a page
that got form submitted through POST method to it. If you come back to such
a page IE (or any other client for that matter) will not automatically
resubmit the form.

Jerry
 
As I stated in my original message I would like my browser to give me a
"Warning: Page has Expired..." message, like it does if you try hitting the
BACK key in a secure website (PayPal.com, etc...)

Robert
 
From what I could tell, the expire notice when you press
back is caused by the page submitting form variables. If
you have the page submit a form (along with a couple
variables) to get to the next page, you should receive
the message when you click back.
 
Do you want me to repeat myself? This happens when you submit data to that
page through POST. It has absolutely NOTHING to do with page expiration.

Jerry
 
Like other have said - you ONLY will get this when a FORM is involved on the
page.
 
This is a form (ASP.NET webform). Is this what you mean? Sorry, ASP.NET /
web development is new to me.
 
Back
Top