Click here to Skip to main content
15,900,906 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to call the Session_End when user closed the browser window.
Posted

Impossible. Forget about it. Just write your site properly, because everyone else knows that there's no reliable way to know when the user closes the browser. You can impliment a timeout in your login system, although they just get logged out anyhow when their session ends.
 
Share this answer
 
If no other tab or no other instance of same browser is running the session will be cleared.In other ways you can write code to reset the session objects in page unload

1) in global.asax , at Session_Start and Session_End method initialize the session variables.
then on page unload call Session.Abandon(); and Session.Clear() methods

protected override void OnUnload(EventArgs e)
{
//Here initialize the Session variables or methods to clear session
}
 
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