Marina
2004-07-06 09:14:00 PM
There is really no reliable way to do anything when the user shuts their
browser window for example.
You could in theory try to capture the event in the onunload event on the
client and make some sort of call to the server to say the the user is
leaving the site. One of the issues with this, is that onunload fires
whenever the pages is unloaded - so for navigating elsewhere to your site,
or just doing a postback. So you would need to keep track of whether or not
the user just did something but stayed within your site, or is actually
leaving, which is tricky.
But overall, there is no easy way to do this, so you would just wait till
the idle timeout is reached (or the user manually logs out) to do your
cleanup.
"JezB" <
jezbroadsword@blueyonder.co.uk>wrote in message
news:e%
23VW0p1YEHA.2408@tk2msftngp13.phx.gbl...
>Ah I see. So it's not really the opposite of Session_Start ...
>Is there any reliable way to capture when a user leaves my site ? I'm
trying
>to audit session activity.
>
>"Marina" <
someone@nospam.com>wrote in message
>news:
uQrPJd1YEHA.2944@TK2MSFTNGP11.phx.gbl...
>>Session_End does not fire when someone navigates elsewhere or closes the
>>browser. It fires when the idle timeout is reached, so you cannot do
>>redirects or anything with the response, if this is how you are testing
>>session_end firing. Try putting in a breakpoint.
>>
>>"JezB" <
jezbroadsword@blueyonder.co.uk>wrote in message
>>news:e66i%
23Z1YEHA.3716@TK2MSFTNGP11.phx.gbl...
>>>Why is my Session_End event in global.asax never firing ? I've tried
>>>fiddling with the timeouts but still nothing.
>>>Ideally I want to do some processing whenever someone leaves my web
>>>application (navigates somewhere else or closes the browser).
>>>
>>>
>>
>>
>
>