By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,988 Members | 1,049 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,988 IT Pros & Developers. It's quick & easy.

Expire problem

P: n/a
I have a page (page1.aspx) with some content.
The user select the content and press a next button and is redirected to
another page (page2.axpx).

I wan't that page1.aspx is not redisplayed when i press the back button in
my browser when i am in page2.aspx.

How do i do this?

thanks,
Gonçalo Boléo
Nov 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Normally code like this can be used.

<%
System.Web.HttpContext.Current.Response.AddHeader( "Cache-Control","no-cache"
)
System.Web.HttpContext.Current.Response.Expires = 0
System.Web.HttpContext.Current.Response.Cache.SetN oStore()
System.Web.HttpContext.Current.Response.AddHeader( "Pragma", "no-cache")%>

However, expiry is rarely a very reliable thing depending on the browser,
its worth reading this:

http://www.mnot.net/cache_docs/

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Gonçalo Boléo" <gb****@netcabo.pt> wrote in message
news:uh**************@TK2MSFTNGP11.phx.gbl...
I have a page (page1.aspx) with some content.
The user select the content and press a next button and is redirected to
another page (page2.axpx).

I wan't that page1.aspx is not redisplayed when i press the back button in
my browser when i am in page2.aspx.

How do i do this?

thanks,
Gonçalo Boléo

Nov 19 '05 #2

P: n/a
Gonçalo Boléo wrote:
I have a page (page1.aspx) with some content.
The user select the content and press a next button and is redirected
to another page (page2.axpx).

I wan't that page1.aspx is not redisplayed when i press the back
button in my browser when i am in page2.aspx.

How do i do this?


In general, you can't. Quoting the HTTP 1.1 spec:

"[...] a history mechanism is meant to show exactly what the user saw
at the time when the resource was retrieved".

Not that most browsers actually implement this behaviour -- AFAIK only
Opera does. Other browsers can be convinced at least to reload the page
by making it non-cacheable (see John's post). But trying to make the
page disappear requires additional logic for page1.aspx.
Cheers,
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de
Nov 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.