473,386 Members | 1,733 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.

preventing backward navigation after logout

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
Nov 19 '05 #1
4 4182
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.No Cache);
Response.Cache.SetExpires(DateTime.Now-new TimeSpan(1,0,0));
Response.Cache.SetLastModified(DateTime.Now);
Response.Cache.SetAllowResponseInBrowserHistory(fa lse);
}


"PJ6" wrote:
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

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

"Sreejith Ram" <Sr*********@discussions.microsoft.com> wrote in message
news:8D**********************************@microsof t.com...
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.No Cache);
Response.Cache.SetExpires(DateTime.Now-new TimeSpan(1,0,0));
Response.Cache.SetLastModified(DateTime.Now);
Response.Cache.SetAllowResponseInBrowserHistory(fa lse);
}


"PJ6" wrote:
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

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

Nov 19 '05 #4
PJ6 wrote:
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,
--
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

8
by: alanstew | last post by:
With the body tag calling out 'window onload', a function with a 'window.open' fails at the 'window.open' line. If I cut out the body tag, the function executes as normal. At first I thought it...
2
by: Brian Mitchell | last post by:
I want to implement a logoff feature in my ASP.NET application (using VB), but how do I expire or delete the pages from the cache so another user can't simply use the back arrow to bring the pages...
0
by: Jeff Waskiewicz | last post by:
Here is what I am trying to accomplish. I have an MDI application on the left side of the client area I have a borderless form that holds a treeveiw for navigation. When an item is selected from...
3
by: roshni86 | last post by:
I have the following code for a logout of an account in php.However it is not working,as when i press the "back" button,the page returns to the previous page where a user had signed and viewed. ...
10
by: chaos | last post by:
How to do logout alert message when i press on the logout image <a href="../logout.php" target="_top" onClick="return logout()"...
1
by: shrik | last post by:
hi everybody. I have following problem. There are two pages. index.jsp and main.jsp in my application Index.jsp contains logging interface in . It submits password and userid to loginform bean. ...
1
by: Kandiman | last post by:
Hiya, i made a asp page, and one of my divs (as a include) is as below. the problem is if the main page is resubmitted, i get logged out again?... heres the code.. i think its on the value=true...
4
by: ravitunk | last post by:
hello all...I have an issue with my ASP.net pages, suppose you have logged into a site using your username and password. On correct username and password you are re-directed to the appropriate page....
10
by: DavidPr | last post by:
When I logout as one user and log in under a different user, it opens with the last user's information. User 1 - Unsername: Davey Jones User 2 - Unsername: David Smith I log out from Davey...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.