Expire Page

T

TCORDON

How can I expire a page so if a user click back for example the page shows
message "This Page has expired" or better yet a peronalized "Page expired"
page.

TIA!
 
G

Guest

The problem is client side caching of pages. The page has to expire
immediately to avoid the back button. This can be done in HTML or
declaratively or programatically in your ASP.NET application. If you know it
is always going to expire, just slap a META tag with instant expiration and
be done with it.

As this is client side, you cannot give a friendly message, as you are
dealing with server side code. The only avenue I can think of for a friendly
message is JavaScript, which is beyond the scope of this discussion group. On
server side, you can capture the submit and store the value. When a person
resubmits from the same form, you simply let them know they cannot resubmit.
Other than that, you are pretty much stuck.

The issue is not .NET, however, but the nature of web applications, which
are designed to be stateless.


---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
S

Steve C. Orr [MVP, MCSD]

This will make sure the page doesn't get pulled from cache:

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

Now are in control from your server side code and you can programatically
determine what you want to display.
 
J

Joerg Jooss

Brock said:
You need to use the no-store cache control header. in ASP.NET 2.0 you
can do this with Page.Response.Cache.SetNoStore(). Here's the RFC:

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

Wish it was *that* easy... first there's
http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.13,
secondly section 14.9.2 (no-store) says
"History buffers MAY store such responses as part of their normal
operation."

Most browsers actually do treat histories like caches (Opera being the
major exception), but the spec defines no way to really force a user
agent to send a new request with each click on back, refresh, or any
other user agent navigation control (as per 13.13).


Cheers,
 

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,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top