Page EXPIRE

arun_mrk

Well-known member
Joined
Apr 1, 2003
Messages
51
Location
beijing
i want my web page(aspx) to expire as soon as my webpage is submitted.
I dont want to my page to be available when the browser back button is clicked.

I have tried a lot of options in asp.net but nothing seem to work.
I will be pleased if some could check the solution before posting a reply.
thanx in adv
 
This wouldnt be a feature of ASP.NET but rather HTML itself. Theres a few things you can toss in your HTML code to prevent browsers from caching a page. Unfortunately I dont have that info. off hand. Ill try to find it when I get a chance, but until then hopefully Ill steer you in the right direction if you want to keep looking yourself.
 
Code:
<%
Response.Cache.SetExpires(New DateTime(1970, 12, 31, 12, 0, 0))
Response.Cache.SetCacheability(HttpCacheability.Private)
Response.Cache.SetValidUntilExpires(False)
Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches)
%>

Code:
<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" />
 
Ah.. thanks Derek, thats the HTML code I was talking about. :) Interesting how ASP.NET does this too...
 
thanks derek for the reply...
But i tried pasting your code on to my web page but it didnt solve my problem. Still i was able to use back button and do the operations inspite of pasting your code.

Have u got any other trick left out?
 
Re: Page Expire...it works

The code in HTML works, I didnt test it in ASP.NET, but you must understand how it works. When you hit the "back" button, the page does show again....but not from the browser cache. It requests the page again.

To see this in action, make a page using the HTML and place it on your local drive. Double click to the page to open it and then go to an internet site. Hit your back button, you see the page right? Now hit the forward button. Now find the page and DELETE it from your local drive. Now hit the back button...page is gone isnt it???
 
Hi arun_mrk
Did u find the solution for expiring the page in .net when user click the browsers back button. Please let me know it as soon as possible,
Thnaks in regards
Arun kumar
 
Back
Top