Page Expire

M

mac

Hi!

I've searched the net for ways to expire a page immediately, so when the
user hit 'Back', they receive the "Page Has Expired" error page and I've
seen a number of posts on how to do it - with the code below:

<%
Response.ExpiresAbsolute = #1/1/1980#
Response.AddHeader "cache-control", "no-cache"
Response.AddHeader "pragma", "no-cache"
%>


However, when I try using this code, nothing happens, when I click 'Back',
it simply takes me back to the previous page. The "Expired Page" error page
should display, correct?


Can anyone tell me how this is supposed to be done?
Is there any wrong with my code? or missing?

Thanks,
Mac
 
B

Brock Allen

Use:
<%
Response.ExpiresAbsolute = #1/1/1980#
Response.AddHeader "cache-control", "no-cache"
Response.AddHeader "pragma", "no-cache"
%>

on the previous page (the one accessed prior to hitting back).
 
J

Joerg Jooss

Thus wrote mac,
Hi!

I've searched the net for ways to expire a page immediately, so when
the user hit 'Back', they receive the "Page Has Expired" error page
and I've seen a number of posts on how to do it - with the code below:

<%
Response.ExpiresAbsolute = #1/1/1980#
Response.AddHeader "cache-control", "no-cache"
Response.AddHeader "pragma", "no-cache"
%>
However, when I try using this code, nothing happens, when I click
'Back', it simply takes me back to the previous page. The "Expired
Page" error page should display, correct?

Only if your browser is IE (this message is browser-specific), and only if
the previous request was a HTTP POST request (i.e. to sumbit form data).
Can anyone tell me how this is supposed to be done? Is there any wrong
with my code? or missing?

That code sample is ASP legacy code. Either use the page directive

<%@ OutputCache Location="None" %>

or

Response.Cache.SetCacheability(HttpCacheability.NoCache);

in your code (behind) file.

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

Similar Threads

How to expire a page (VB) ASP.NET 4
Force Page Expire 0
Expire IE browser cache, again. 4
Page Expire 2
Expire Page 4
Cache dataset and expire 3
How to expire an ASP.NET page? 6
Expire Pages in Browser? 2

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top