Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET Web Development
Hello,
I have created project in asp.net , when click browser back or forward button ( Navigate browser page), need to redirect into Logout page if its in login state . how can i do it? please help me soon...
Posted 24-Jul-12 18:13pm
Edited 24-Jul-12 18:17pm
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Try this:
<script type="text/javascript" language="javascript">
window.history.forward(1);
document.attachEvent("onkeydown", my_onkeydown_handler);
function my_onkeydown_handler()
{
switch (event.keyCode)
{
case 116 : // F5;
event.returnValue = false;
event.keyCode = 0;
window.status = "We have disabled F5";
break;
}
}
</script>
 
code behind:
Session.Clear();
Session.Abandon();
 
Also refer:
Three ways to disable browser back button[^]
Use Javascript to restrict user from pressing back button in browser[^]
A Thorough examination of browser back button[^]
Simple solution[^]
Disabling browser's back functionality on sign out from Asp.Net[^]
Browser back button issue after logout[^]
 
..and lot more similar answer on CP QA Forum[^]
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 404
1 Nirav Prabtani 307
2 Abhinav S 210
3 PIEBALDconsult 160
4 Dave Kreskowiak 155
0 OriginalGriff 7,580
1 Sergey Alexandrovich Kryukov 6,806
2 Maciej Los 3,919
3 Peter Leow 3,693
4 CHill60 2,742


Advertise | Privacy | Mobile
Web02 | 2.8.140721.1 | Last Updated 25 Jul 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100