Click here to Skip to main content
15,913,610 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to create logout button or link in asp.net
when user click on logout button or link then user did not come back when user
click the back button
Posted
Updated 16-Oct-12 0:05am
v2

you need to store session information t implement this. when user will click back button then you need to clear session information.
 
Share this answer
 
Please go through article Browser back button issue after logout[^] for a nice explanation of your problem and find solutions also.
You can take a look at the answers in logout[^] and Clearing session after logout[^] for your query.
 
Share this answer
 
v2
You can use session.abandon()

or

formsauthentication.signout()

In both the cases back button will function but the session will not be active.

If you want to cancel the back button then use this code.
JavaScript
<script type="text/javascript">
    window.history.forward();
    function noBack() { window.history.forward(); }
</script>

<body onload="noBack();">
    onpageshow="if (event.persisted) noBack();" onunload=""></body>
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900