I am wondering if I can handle a session timeout event. I need to make a function call to my function right before session timeouts or user left my page, or closed browser w
The web is stateless so you're not going to know whether the user has closed the browser window. You can use the 'Session_End' event in the global.asax file for session timeouts. If you want access to all sessions, you can store them in a collection via the 'Session_Start' event, also in the global file ..
Edit: If you want to intercept the close event of a page using javascript, here's how (note, this is unreliable):
window.onbeforeunload = closeIt;
function closeIt(){
return "You have unsaved changes. Are you sure you want to leave this page?";
}