Hi Bill,
This is a tricky issue. The odds of you getting a succesful postback are
50/50
to say the best. I've had about a 95% success rate doing this:
1. Capture the onbeforeunload event in your body tag.
2. Incorporate the WebService.htc.
3. When the onbeforeunload event fires run a function that uses the
WebService.htc to tell a web service.
The browser will close before you get a response back but, about 95% of the
time, your web service will get hit and the user can successfully be logged
out. Note, that using the latest IE and Windows XP you will achieve almost
100% results. This is sort of complicated until you get the hang of it. If
this isn't something you want to try then here is another suggestion to
improve your chances but it might seem clunky to the user:
Have a main page that the user browses to. To run your app, they click a
button or link and then you use window.open() to create a new browser
window. This is the window your app runs from. Don't ask me why, but the
success rate of a postback from onbeforeunload seems to be much higher for
browsers launched from javascript than from browsers launched by the user.
Good luck! Ken.
--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.
"Bill Manring" <(E-Mail Removed)> wrote in message
news:4678E0EF-74B0-47BA-8B07-(E-Mail Removed)...
> I need to capture the event when the user closes the browser in my
> application. I have some code in the session_End event, which works fine
> when the session times out, but I need to end the session immediately when
> the user closes the browser.
>
> Does anyone know a way of doing this?
>
> --
> Thanks,
>
> Bill Manring
>