To call Session_End when the user closes the browser window??
-
Hi guys, I just want to do some clean up in the Session_End at Global.aspx. However, if the user closes the browser window that event is not fired. how can I call explicity protected void Session_End(Object sender, EventArgs e) when the user closes the browser window? I have a button that user can press logoff and I can abondan the session but if the user closes the window it doesn't fire. possible at all? -- modified at 1:42 Wednesday 14th September, 2005
-
Hi guys, I just want to do some clean up in the Session_End at Global.aspx. However, if the user closes the browser window that event is not fired. how can I call explicity protected void Session_End(Object sender, EventArgs e) when the user closes the browser window? I have a button that user can press logoff and I can abondan the session but if the user closes the window it doesn't fire. possible at all? -- modified at 1:42 Wednesday 14th September, 2005
-
Hi guys, I just want to do some clean up in the Session_End at Global.aspx. However, if the user closes the browser window that event is not fired. how can I call explicity protected void Session_End(Object sender, EventArgs e) when the user closes the browser window? I have a button that user can press logoff and I can abondan the session but if the user closes the window it doesn't fire. possible at all? -- modified at 1:42 Wednesday 14th September, 2005
hi there, Session End will fire when a session is abandoned or times out. This is because the server has no way of knowing when the browser has closed (as www is stateless system). So that is impossible at all :( << >>
-
That is only possible using javascript. In the onunload event, open a new window with a page that does the logoff, and then closes itself. --- b { font-weight: normal; }
Hi gufa, your suggestion looks very nice. However, wouldn't it be as a pop up window? How if the users has blocked pop up window? Can i do it someway transparents so users really don't know about it ...? sorry, i am not very good in javascript though can figure out what you mean. thanks
-
Hi gufa, your suggestion looks very nice. However, wouldn't it be as a pop up window? How if the users has blocked pop up window? Can i do it someway transparents so users really don't know about it ...? sorry, i am not very good in javascript though can figure out what you mean. thanks
Yes, it's a popup window. That is the only way to contact the server as the main page is closing. If javascript is disabled, it won't work. If popups are disabled, it won't work. So, it's not ideal, but it's the only way available. The only alternative would be to make the page request data from the server at a set interval, so that you can detect when it stops requesting data. --- b { font-weight: normal; }