title: How to logout When a user closes the Web Application without loggin out
body: <p>I have created Asp.net MVC4 Web application. In which, when a user logs in and do some browsing and then close the application from browser without logging out,then previously logged user is not logged out and When application is restarted then previously logged user is logged.</p>
  
  <p><strong>What i am willing is that if a user is logged in and close the web application,then user should be logged out instantly.</strong></p>
  
  <p><strong>Note -I have not deployed the application on IIS by now.
  So, as web is stateless.So,will it work correctly incase of real scenario when applicaiton will be deployed.</strong></p>
  
  <p>Currently, i am checking it on my development machine and browser.</p>
  
  <p>I have seen following sample but No one has clear explanation</p>
  
  <p><a href="https://stackoverflow.com/questions/5354627/automatically-logging-users-out-of-asp-net-website-on-close">automatically logging users out of asp.net website on close</a></p>
  
  <p><a href="https://stackoverflow.com/questions/2910480/how-to-kill-the-session-when-user-closed-the-brower-without-logout">how to kill the session when user closed the browser without logout</a></p>
  
  <p>So, is there any event that i can handle on dispose or some sort of shutdown as what we have in desktop application.
  Actually, i have not worked web application before.</p>