Page expiration

  • Thread starter Thread starter Ken
  • Start date Start date
K

Ken

After searching through the visual studio .net help, and
searching on the web, I cannot find a difinitive way to
make a page expire so that when a user clicks on the back
button, the browser displays the "page has expireded"
message. I've not found any combinations of
response.cache members that provide for this
functionality. I'd appreciate any help.
 
Hi

Try the following code

response.Cache.Setexpires(somepastdate)
response.cache.setcacheability(Httpcacheability.nocache)

- Gopi
 
Gopi,

With this code in the page_load event

System.DateTime dt = new DateTime
(1961, 1, 5, 1, 1, 1, 1);
Response.Cache.SetExpires(dt);
Response.Cache.SetCacheability
(HttpCacheability.NoCache);


I can bring up the page, navigate to a different page,
then click my browsers back button and the page displays,
no "this page has expired message".
 
Try this code:

Response.Expires = 0
Response.Cache.SetNoStore()
Response.AppendHeader("Pragma", "no-cache")
 
Back
Top