Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Raising event on the server side when closing browser


Message #1 by "Waleed Fahmy" <fahmywaleed@h...> on Tue, 21 May 2002 20:02:53
Hi
   How can I execute a procedure on the server side if the user closes 
his/her browser. Or in other words how can I raise an event to be executed 
on the server side if the user closes his/her browser

Thanks
Message #2 by Feduke Cntr Charles R <FedukeCR@m...> on Tue, 21 May 2002 15:33:18 -0400
	Unfortunately, you can't.  At least not easily.  The only way to do
it is to intrusively install a program that can "phone home" that runs
attached to the browser process and does so when the browser is closing.

	Some people might mention Session_OnEnd event, which fires when a
session goes out of scope (usually due to a time out; a user closing their
browser does not end a session, it just times out on its own accord).

- Chuck

-----Original Message-----
From: Waleed Fahmy [mailto:fahmywaleed@h...]
Sent: Tuesday, May 21, 2002 4:03 PM
To: ASP+
Subject: [aspx] Raising event on the server side when closing browser


Hi
   How can I execute a procedure on the server side if the user closes 
his/her browser. Or in other words how can I raise an event to be executed 
on the server side if the user closes his/her browser

Thanks
Message #3 by Imar Spaanjaars <Imar@S...> on Tue, 21 May 2002 23:15:41 +0200
You could also use this:

<body onunload="return window_onunload()">

Then, in the function window_onunload() you could set the location.href to 
a server side page that does the stuff you want.

This has some serious drawbacks. First of all, it's not guaranteed to work, 
and won't work on all browsers. Another major disadvantage is that it can 
really annoy people with dial up accounts. If they close the connection 
before they close the browser, they will be prompted for a new connection 
as soon as the onunload event fires.

HtH

Imar



At 08:02 PM 5/21/2002 +0000, you wrote:
>Hi
>    How can I execute a procedure on the server side if the user closes
>his/her browser. Or in other words how can I raise an event to be executed
>on the server side if the user closes his/her browser
>
>Thanks


Message #4 by "Waleed Fahmy" <fahmywaleed@h...> on Tue, 21 May 2002 23:01:57
This method would work I have already tried it but the problem is using 
this OnUnload event will fire each time the web page makes a round trip to 
the server for any server side control processing

> You could also use this:

<body onunload="return window_onunload()">

Then, in the function window_onunload() you could set the location.href to 
a server side page that does the stuff you want.

This has some serious drawbacks. First of all, it's not guaranteed to 
work, 
and won't work on all browsers. Another major disadvantage is that it can 
really annoy people with dial up accounts. If they close the connection 
before they close the browser, they will be prompted for a new connection 
as soon as the onunload event fires.

HtH

Imar



At 08:02 PM 5/21/2002 +0000, you wrote:
>Hi
>    How can I execute a procedure on the server side if the user closes
>his/her browser. Or in other words how can I raise an event to be executed
>on the server side if the user closes his/her browser
>
>Thanks



  Return to Index