Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello,

I am working as a web developer.

My problem is I have created a login page and a logout page and two webforms having same master page.
In the logout page, in page load, I write code as response.redirect("Login.aspx");
I want to stop back button in browser after logout.

Thank you.
Posted
Updated 31-Oct-11 23:22pm
v2
Comments
Dalek Dave 1-Nov-11 5:23am    
Edited for Readability.

Hi,
you can use javascript to solve your problem.

Please try this code:

XML
<script type="text/javascript">
function noBack(){window.history.forward();}
noBack();
window.onload=noBack;
window.onpageshow=function(evt){if(evt.persisted)noBack();}
window.onunload=function(){void(0);}
</script>
 
Share this answer
 
v2
Comments
Dalek Dave 1-Nov-11 5:23am    
Good Answer
here u will get the solution definitely:
Browser back button issue after logout[^]
 
Share this answer
 
v2
Before redirecting user to login page clear session/cookies in the project.

C#
Session.Abandon();
DeleteClientCookiesAll();
Response.Redirect("login.aspx");
 
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