Page expiration

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

S Gopikrishna

Hi

Try the following code

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

- Gopi
 
G

Guest

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".
 
S

Steve C. Orr [MVP, MCSD]

Try this code:

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

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top