473,662 Members | 2,622 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4196
use this code to prvent the page from being cached..

private void Page_Load(objec t sender, System.EventArg s 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 (HttpCacheabili ty.NoCache);
Response.Cache. SetExpires(Date Time.Now-new TimeSpan(1,0,0) );
Response.Cache. SetLastModified (DateTime.Now);
Response.Cache. SetAllowRespons eInBrowserHisto ry(false);
}


"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*********@di scussions.micro soft.com> wrote in message
news:8D******** *************** ***********@mic rosoft.com...
use this code to prvent the page from being cached..

private void Page_Load(objec t sender, System.EventArg s 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 (HttpCacheabili ty.NoCache);
Response.Cache. SetExpires(Date Time.Now-new TimeSpan(1,0,0) );
Response.Cache. SetLastModified (DateTime.Now);
Response.Cache. SetAllowRespons eInBrowserHisto ry(false);
}


"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.d e
Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
2439
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 was the entire function failing, but I tested with alerts and found that it was only the 'window.open' that fails to execute. The function is being called by a link, and I suspected some problem with the body alink/vlink but after cutting that out...
2
1945
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 back up? Thanks!!
0
1406
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 the treeview it opens a seperate form. Similar to an MDI Windows Explorer. Now, I want to prevent any for form from being moved into the area occupied by the navigation form. I used the following code do do that... Private Sub...
3
6399
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. <?php //start the session session_start(); //check to make sure the session variable is registered if(session_is_registered('userid')){ //session variable is registered, the user is ready to logout
10
4062
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()" "MM_nbGroup('down','group1','logout','',1)""MM_nbGroup('down','group1','logout','../button_images/logout_button_down.png',1)" onMouseOver="MM_nbGroup('over','logout','../button_images/logout_button_down.png','../button_images/logout_button_down.png',1)" onMouseOut="MM_nbGroup('out')" ><img name="logout"...
1
14049
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. following are entries in struts-config.xml file <action input="index.jsp" name="loginform" path="/login" scope="session" type="com.myapp.struts.loginaction"> <forward name="success" path="/main.jsp"/>
1
3322
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 for the hidden textbox on the logout sub.. but how do i get round this? can i not change the value onclick? <div id=Rightbody> <!--<form id="RightBodyForm" name="RightbodyForm" method="post" action="Guestbook2.asp">--> <% Response.Expires...
4
4875
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. Then if you click your browser's backward navigation button then the login page is shown (where you entered your username and password) and then if you click the browser's forward navigation button then you are re-directed to the page without again...
10
4808
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 Jones, then login as David Smith the Welcome message below will show "Welcome Davey". And it will be Davey's information that is accessible - not David Smith's. So something is amiss but I don't know what. (BTW, this login script is based on the...
0
8344
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8857
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8764
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8546
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7367
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5654
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4347
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2762
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1993
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.