session end

JL94x4

New Member
hi,<BR><BR>how to end the session when the user closes the browser(using the one at the right top corner).<BR><BR>thx<BR>Philipdear friend!<BR> It is not possible i think.Because there is no special event which will get trigger when the user closes the browser(using the one at the right top corner).If u use onunload it wont be the right solution.Because it will also be called when the page get refreshed.At the same time you have to see the browser combatibility also.Netscape doesnt support some events which are supported by IE.(example onblur)<BR> Even i do have faced the same problem.But still now no one suggested anything.<BR>I asked a similar question further down the page.<BR><BR>All I know is that the Session_End method in Global.asax does NOT work reliably. Currently, my site says that there are 68 active users which is certainly not true.<BR><BR>I was hoping that this would be something that was fixed in ASP.NET, but unfortunately it wasn't.can javascript help us in this?javascript is executed on the client side, after the ASP sessions have been dealt with and spewed to the client. You cannot interact the javascript with your sessions. <BR><BR>Perhaps this *might* work, in IE. Write a function for the onClose event which sets the source file (src=http://aspmessageboard.com/archive/index.php/"") of an IFRAME (hidden from view with CSS of course) to an ASPX page that kills the user's session ID? Therefore you have an iframe with a src set to nothing. Onclose you change this src to say, "killsession.aspx" which will then terminate his/her session. when this page loads, it should close the parent window (and the iframe child as well). <BR><BR>Hope this might have helped,<BR><BR>-Vadim C.those function can be in Javascript.. just in case I might have confused you. Just the iframe src file will have some asp to kill your session.<BR><BR>-Vadim C.if u dont mind, can u come out with the javascript code?<BR><BR>thx<BR>PhilipI have this code currently in use as we speak. What you do is have an onUnload event in your body of the page that is open. The onUnload event should fire some code if the window is closed, or the user goes somewhere else. What I do is have a function that redirects them to a "logout" page. In my case the window is a javascript popup window, so I have the go to the logout page, run my server side logout routine, then close the window. If you are using a fully functional window (in other words, if they can type something in the address bar and go to another page) you can still use this, but they need to be redirected to the page they were trying to get to once your logout routine has finished... Netscape browsers that do not support the OnUnload event?<BR><BR>And what if the user has multiple windows open at your site and they close one?
 
Back
Top