ASP - page expire - Asked By srinivas gajavada on 04-Jun-01 05:15 PM

how do i show page expiration msg whenever user navigates from my page to another page?
i tried

 Response.CacheControl = "no-cache"
 Response.AddHeader "Pragma", "no-cache"
 Response.Expires = -1000

options? still it does not work

This is what we use. - Asked By Robbe Morris on 04-Jun-01 05:24 PM

Are you really wanting to show an expiration message or just be sure the page gets shown properly and isn't cached?

Response.Buffer = True
Response.AddHeader "cache-control", "private"
Response.AddHeader "pragma", "no-cache"
Response.ExpiresAbsolute = #January 1, 1990 00:00:01# 

should not get cached - Asked By srinivas gajavada on 04-Jun-01 05:26 PM

basically it should not get cached !

Ok... - Asked By Robbe Morris on 04-Jun-01 05:29 PM

Then the code I just gave you ought to work for you.  It must be placed at the top of each page or in an include that gets called at the top of each page.
doesn't work - Asked By srinivas gajavada on 04-Jun-01 05:30 PM
i tried it, it does'nt work
It'll still put the HTML - Asked By Robbe Morris on 04-Jun-01 05:32 PM
in the user's cache but IIS should reprocess the page each time.  Is it not reprocessing the page?
i think so - Asked By srinivas gajavada on 04-Jun-01 05:35 PM
i am testing with the back button.

i am showing my page(which i want to expire immediately) and then going to some site and when i hit back button, it shows me? even if hit F5 button it shows
Doesn't work - Asked By Robbe Morris on 04-Jun-01 05:37 PM
with the back button.  The back button does not make a return trip the server.  The caching prevention is server side in IIS.  It merely mandates that IIS reprocess the page.

You will have to clear out the history in JavaScript or VBScript to prevent the back button if you don't want them to view an old page.
can i delete - Asked By srinivas gajavada on 04-Jun-01 05:42 PM
can i delete that particular page from the page bcos i don't want to clear the whole history of the user browser.
Not sure... - Asked By Robbe Morris on 04-Jun-01 05:44 PM
Don't have my JavaScript book for syntax.  Not sure whether you can delete specific entries or not.

Why is it so important to prevent them from going back to the previous page?
let me explain - Asked By srinivas gajavada on 04-Jun-01 05:50 PM
let me explain my complete scenerio, so that you can help me out

i am having a login page(login.asp) to authenticate. once the user logins i am storing the userid in the Session variable and navigating(response.redirect)  him/her to the next page where i am showing him some files(files.asp) of that user. ofcourse i am killing the session once the at the end of files.asp
once the user navigates from files.asp to some other site and comes back with back button. i don't want to show that page.
Why kill the session? - Asked By Robbe Morris on 04-Jun-01 06:36 PM
...In either situation, this will require a client side solution.  You'll have to create some sort of JavaScript function that stores either a cookie or hidden value when they leave the page.  Then when they return (I don't believe onLoad in the BODY tag gets fired using the back button), redirect them to another page.
See This - SP replied to srinivas gajavada on 07-Jun-08 01:44 AM
See the following article for details about showing message when their session is about
to expire.  

Check for session value. If it is expired then give a message using javascript
that Login session has expired and user have to login again.