Monday, August 16, 2010

How to stop user from moving to the previous page through GoBack button in ASP.NET...?

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...?How to stop user from moving to the previous page through GoBack button in ASP.NET...?
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:





%26lt;html%26gt;


%26lt;head%26gt;


%26lt;meta http-equiv=';refresh'; content=';1;url=real_logout';%26gt;


%26lt;/head%26gt;


%26lt;body%26gt;


Logging out...


%26lt;/body%26gt;


%26lt;/html%26gt;





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 -How to stop user from moving to the previous page through GoBack button in ASP.NET...?
its simple just make use of session management

Report Abuse



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.
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
Password protect your website. Once someone logs out, they cannot access any page withour logging again.

No comments:

Post a Comment