preventing backward navigation after logout

P

PJ6

After logging out of my test site I would like to be able to not allow the
user to navigate back to previous pages. It's not super-important because if
they try to do anything the login state has been wiped and anything that
posts back or refreshes the page will send them back to the login screen...
but it would be nice if either the navigation history is wiped, or some
setting is set that causes all the previous content to be expired. Is that
possible?

Paul
 
G

Guest

use this code to prvent the page from being cached..

private void Page_Load(object sender, System.EventArgs e)
{
ExpirePageCache();
//.......rest of the page_load logic....................
}


/// <summary>
/// This function prevent the page being retrieved from broswer cache
/// </summary>
private void ExpirePageCache()
{
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.Now-new TimeSpan(1,0,0));
Response.Cache.SetLastModified(DateTime.Now);
Response.Cache.SetAllowResponseInBrowserHistory(false);
}
 
P

PJ6

This would seem to always prevent the user from navigating back, and not
just after some action. That would annoy most users. Is there a way to
expire all previous pages' caches retroactively?

Paul
 
S

sreejith.ram

Is there a way to expire all previous pages' caches retroactively?

I believe, it is not possible to remove any page other than current
page from cache.
 
J

Joerg Jooss

PJ6 said:
After logging out of my test site I would like to be able to not
allow the user to navigate back to previous pages. It's not
super-important because if they try to do anything the login state
has been wiped and anything that posts back or refreshes the page
will send them back to the login screen... but it would be nice if
either the navigation history is wiped, or some setting is set that
causes all the previous content to be expired. Is that possible?

In general no. If the browser navigates back through it's local
history, there's nothing you can do.

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

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top