473,386 Members | 1,801 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Expire Page

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!
Nov 19 '05 #1
4 2337
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

-Brock
DevelopMentor
http://staff.develop.com/ballen
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!


Nov 19 '05 #2
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!
***************************

"TCORDON" wrote:
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!

Nov 19 '05 #3
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.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"TCORDON" <tc******@hotmail.com> wrote in message
news:OT**************@TK2MSFTNGP14.phx.gbl...
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!

Nov 19 '05 #4
Brock Allen wrote:
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/....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,
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de
Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: David Graham | last post by:
Hi I have asked this question in alt.php as the time() function as used in setcookie belongs to php - or does it belong equally in the javascript camp - bit confused about that. Anyway, can anyone...
3
by: martin | last post by:
Hi, I am storing a dataset in cache, which is happening fine. I can easily retrive it at postback from the cache, cast it to a dataset and reuse it. However I have specified that the cache...
3
by: Joey Powell | last post by:
This message was originally posted to the aspnet.security newsgroup, but no one there has ever heard of this before. That is why I am posting this message here, so that more people will see it... ...
13
by: Veeresh | last post by:
I am using .Net 1.1. How to expire an .aspx page? I think I have to use HttpCachePolicy class for this. But not sure how to use and where to this code to work. Is it in Page_load event. Thanks...
2
by: karunakar | last post by:
Hi All I dont want to expire the applicatoion Once login the application i dont want to expire the application Presently iam doing using cookies this is not working fine Please help me out ...
23
by: Phil Powell | last post by:
// OBTAINED FROM http://www.javascripter.net/faq/settinga.htm // NOTE THAT IF YOU SET days TO -1 THE COOKIE WILL BE SET TO YESTERDAY AND THUS EXPIRE function setCookie(name, value, days, docObj)...
3
by: bbgraph | last post by:
Does anyone have a suggestion for doing this with a date function rather than the typical content=(number of seconds) function? I have an events page that I'd like to expire on a certain date and,...
2
by: Chris Davoli | last post by:
How do you expire pages so that the user can't hit the back button on his browser in Internet Explorer? I've tried the meta tag in the header that has an expires = 0 and also in vb.net...
0
by: aspineux | last post by:
setacl and getacl look to be already "Cyrus" specific (according the doc), why not to extend imaplib a little bit more ? Here are some code I wrote and tested to support cyrus "expire" that...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.