Detect total time the user is logged-in asp.net
<p>I have asp.net web site in which user can login and also do logout
Now i need to capture the total time duration for which user was logged-in to the site.
So to do this i need to know two things
1. Login time
2. Logout time</p>

<p>At the time of login i can get the first thing which is "Login time", thats fairly easy
Now the second thing is more complicated. How do i update the Logout time? I know i can update it on the logout button but what if user directly close the browser?
I have setup the global.asax file but i dont think "Session_End" event will fire on closing the browser.
I have seen some of the website in which where you close the browser window it shows on dialog saying something like "press Ok to stay on the page OR press "Cancel" to stay on the current page". I am thinking i can use the UpdatePanel's PageMethods to do my task here. Is this possible? If yes then how?</p>

<p>Do you guys have any other idea to find out the total logged-in time for the user? </p>

<p>Thank you.</p>
