Question:
How to stop user from moving to the previous page through GoBack button in ASP.NET...?
Baadshah
2009-10-09 08:41:53 UTC
Hello Friends,

I want to the facility which Orkut and all E-mail service providers provide. After LOGOUT, even if user clicks the Back button of the browser, he can not go to the previous page because he has logged out.

How can I achieve this functionality...?
Four answers:
Ken B
2009-10-09 08:58:34 UTC
Perhaps one of the simplest (though easily defeated) methods is to have the logout take you to a page which then redirects you to another page. perhaps something like:













Logging out...







This will show the "logging out" page for 1 second, and then take you to the "real" logged out page. Pressing the "back" button will take you to this "logging out" page and then redirect you back to the "real" page once again.



Of course, many browsers allow you to go back more than one page by using the browser's navigation buttons, and the user could simply go back 2 pages.



You could have your web pages generate the appropriate code (I forget the details) that tell the browser not to cache the pages while logged in. Then, pressing "back" will force the browser to request the page again, rather than using its cached version, and your web server should give an error because you're not logged in any more.



- kb -
flow
2009-10-09 15:59:29 UTC
you can use a script and insert it in a page where you don't want users to click the back button. or you can hide the whole menu bar as weel. but there are always ways to cheat that, for example, you can hit the backspace button then it will take back to the previuos page.
anonymous
2009-10-09 15:48:07 UTC
Hey,



I`ve got an idea...



add this to the button click event:



If UserLoggedOut = True Then



MsgBox("You have logged out", MsgBoxStyle.Critical, "Error"



Else



TheEventForGoingBack



End If
Growl
2009-10-09 18:16:05 UTC
Password protect your website. Once someone logs out, they cannot access any page withour logging again.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...