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

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

VB Programmer

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?
 
D

Dhananjay Modak

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"
 
V

VB Programmer

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?
 
W

William F. Robertson, Jr.

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" />
 
V

VB Programmer

Thanks.

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

Any links to samples, etc..?
 
J

Jerry III

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
 
V

VB Programmer

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
 
M

Mark Fox

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

Jerry III

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
 
M

Michael Tissington

Like other have said - you ONLY will get this when a FORM is involved on the
page.
 
V

VB Programmer

This is a form (ASP.NET webform). Is this what you mean? Sorry, ASP.NET /
web development is new to me.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top