Click here to Skip to main content
15,906,628 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My website pages are inside the Master Page, I want to redirect to the Login page if the user close the browser without clicking the Logout Link. How can I do it.
Updated 1-May-14 21:11pm
Thanks7872 2-May-14 3:13am    
What? If browser is closed how can you see the redirected page?
DamithSL 2-May-14 3:13am    
after browser closed you can't redirect? what exactly you want to do?

1 solution

You can't redirect to Login page, because the browser window is going to be closed.

Use onbeforeunload event[^] to logout user without redirecting.
Share this answer
Robymon 2-May-14 3:48am    
How to Redirect to Login Page onBeforeUnload
Maciej Los 2-May-14 3:51am    
As i mentioned: you can't!
You can call logout function.

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