473,725 Members | 2,232 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help: How to detect if the browser is closed?

hb
Hi,

Would you please tell me how to detect if the client's browser is closed?

I need such event to trigger a database modification.

Thank you

hb
Nov 18 '05 #1
6 5239
Hi,

For the most part, your server will never know when the client browser is
closed. Here are some very limited things you can do to tell if the client
is still on your page (whether open or closed)

While your server is processing a request, if it takes a long time to
service that request, you can call Response.IsClie ntConnected to see if the
browser is still on your page.

You can add code to your page's client onunload event which could notify
your server that the page is unloading. This will not tell you if the
browser is being closed.
For example: <body onunload="alert ('closing');">

If you use this method, use showModalDialog to browse to a page which
notifies your server. That page will return JavaScript back to the dialog
with window.close(); .

Another option is that you could write an ActiveX control. However, that
control will only exist so long as the user is on your page. You still
won't know if they close the browser.

Essentially, the internet was designed such that the server only knows
about the browser while it is processing a request from the browser. The
rest of the time, the server is not aware of the browser.

Does this answer your question?

Thank you, Mike
Microsoft, ASP.NET Support Professional

Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three straightforward
steps listed to improve your computer's security.

This posting is provided "AS IS", with no warranties, and confers no rights.
--------------------
From: "hb" <ho****@goodoff ices.com>
Subject: Help: How to detect if the browser is closed?
Date: Mon, 17 Nov 2003 09:09:01 -0500
Lines: 11
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <er************ **@TK2MSFTNGP10 .phx.gbl>
Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
NNTP-Posting-Host: x403446fe.ip.e-nt.net 64.52.70.254
Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP10.phx.g bl
Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.framew ork.aspnet:1913 66
X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet

Hi,

Would you please tell me how to detect if the client's browser is closed?

I need such event to trigger a database modification.

Thank you

hb


Nov 18 '05 #2
hb
Hi, Mike,

Thank you for the help.

Would you please tell me where should I put
if(Response.IsC lientConnected)
{
//do something
}

Thank you

hb
""Mike Moore [MSFT]"" <mi****@online. microsoft.com> wrote in message
news:H$******** *****@cpmsftngx a06.phx.gbl...
Hi,

For the most part, your server will never know when the client browser is
closed. Here are some very limited things you can do to tell if the client
is still on your page (whether open or closed)

While your server is processing a request, if it takes a long time to
service that request, you can call Response.IsClie ntConnected to see if the browser is still on your page.

You can add code to your page's client onunload event which could notify
your server that the page is unloading. This will not tell you if the
browser is being closed.
For example: <body onunload="alert ('closing');">

If you use this method, use showModalDialog to browse to a page which
notifies your server. That page will return JavaScript back to the dialog
with window.close(); .

Another option is that you could write an ActiveX control. However, that
control will only exist so long as the user is on your page. You still
won't know if they close the browser.

Essentially, the internet was designed such that the server only knows
about the browser while it is processing a request from the browser. The
rest of the time, the server is not aware of the browser.

Does this answer your question?

Thank you, Mike
Microsoft, ASP.NET Support Professional

Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three straightforward steps listed to improve your computer's security.

This posting is provided "AS IS", with no warranties, and confers no rights.

--------------------
From: "hb" <ho****@goodoff ices.com>
Subject: Help: How to detect if the browser is closed?
Date: Mon, 17 Nov 2003 09:09:01 -0500
Lines: 11
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <er************ **@TK2MSFTNGP10 .phx.gbl>
Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
NNTP-Posting-Host: x403446fe.ip.e-nt.net 64.52.70.254
Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP10.phx.g bl
Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.framew ork.aspnet:1913 66 X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet

Hi,

Would you please tell me how to detect if the client's browser is closed?
I need such event to trigger a database modification.

Thank you

hb

Nov 18 '05 #3
Hi,

Here's an article that describes usage of IsClientConnect ed and includes a
code sample. It's old ASP code, but the concept remains the same.

182892 HOWTO: Use IsClientConnect ed to Check If Browser Is Connected
http://kb/article.asp?id=Q182892

Thank you, Mike
Microsoft, ASP.NET Support Professional

Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three straightforward
steps listed to improve your computer’s security.

This posting is provided "AS IS", with no warranties, and confers no rights.
--------------------
From: "hb" <ho****@goodoff ices.com>
References: <er************ **@TK2MSFTNGP10 .phx.gbl> <H$************ *@cpmsftngxa06. phx.gbl> Subject: Re: Help: How to detect if the browser is closed?
Date: Mon, 17 Nov 2003 16:52:19 -0500
Lines: 90
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <es************ **@TK2MSFTNGP12 .phx.gbl>
Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
NNTP-Posting-Host: x403446fe.ip.e-nt.net 64.52.70.254
Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP12.phx.g bl
Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.framew ork.aspnet:1915 30
X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet

Hi, Mike,

Thank you for the help.

Would you please tell me where should I put
if(Response.IsC lientConnected)
{
//do something
}

Thank you

hb
""Mike Moore [MSFT]"" <mi****@online. microsoft.com> wrote in message
news:H$******** *****@cpmsftngx a06.phx.gbl...
Hi,

For the most part, your server will never know when the client browser is
closed. Here are some very limited things you can do to tell if the client is still on your page (whether open or closed)

While your server is processing a request, if it takes a long time to
service that request, you can call Response.IsClie ntConnected to see if

the
browser is still on your page.

You can add code to your page's client onunload event which could notify
your server that the page is unloading. This will not tell you if the
browser is being closed.
For example: <body onunload="alert ('closing');">

If you use this method, use showModalDialog to browse to a page which
notifies your server. That page will return JavaScript back to the dialog with window.close(); .

Another option is that you could write an ActiveX control. However, that
control will only exist so long as the user is on your page. You still
won't know if they close the browser.

Essentially, the internet was designed such that the server only knows
about the browser while it is processing a request from the browser. The
rest of the time, the server is not aware of the browser.

Does this answer your question?

Thank you, Mike
Microsoft, ASP.NET Support Professional

Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three

straightforward
steps listed to improve your computer's security.

This posting is provided "AS IS", with no warranties, and confers no

rights.


--------------------
From: "hb" <ho****@goodoff ices.com>
Subject: Help: How to detect if the browser is closed?
Date: Mon, 17 Nov 2003 09:09:01 -0500
Lines: 11
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <er************ **@TK2MSFTNGP10 .phx.gbl>
Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
NNTP-Posting-Host: x403446fe.ip.e-nt.net 64.52.70.254
Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP10.phx.g bl
Xref: cpmsftngxa06.ph x.gbl

microsoft.publi c.dotnet.framew ork.aspnet:1913 66 X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet

Hi,

Would you please tell me how to detect if the client's browser is closed?
I need such event to trigger a database modification.

Thank you

hb



Nov 18 '05 #4
hb
Hi, Mike,

I have tried the method provided by the article Q182892.

The IsClientConnect will become false when either the browser is closed or
the user is redirected to another URL. I tried to use Request.Url to catch
the
new URL after IsClientConnect =false, but the URL I caught stay the same.

Plus, the process uses about 70% CPU. So this method cannot be use in
production code.

What I am looking for is a way that can allow me to detect if the browser
gets closed or
if user gets redirected to another URL that has different domain. The result
of such detection
triggers a modification in database.

Would you please give me some ideas?

Thank you

hb
""Mike Moore [MSFT]"" <mi****@online. microsoft.com> wrote in message
news:nw******** ******@cpmsftng xa06.phx.gbl...
Hi,

Here's an article that describes usage of IsClientConnect ed and includes a
code sample. It's old ASP code, but the concept remains the same.

182892 HOWTO: Use IsClientConnect ed to Check If Browser Is Connected
http://kb/article.asp?id=Q182892

Thank you, Mike
Microsoft, ASP.NET Support Professional

Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three straightforward steps listed to improve your computer's security.

This posting is provided "AS IS", with no warranties, and confers no rights.

--------------------
From: "hb" <ho****@goodoff ices.com>
References: <er************ **@TK2MSFTNGP10 .phx.gbl>

<H$************ *@cpmsftngxa06. phx.gbl>
Subject: Re: Help: How to detect if the browser is closed?
Date: Mon, 17 Nov 2003 16:52:19 -0500
Lines: 90
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <es************ **@TK2MSFTNGP12 .phx.gbl>
Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
NNTP-Posting-Host: x403446fe.ip.e-nt.net 64.52.70.254
Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP12.phx.g bl
Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.framew ork.aspnet:1915 30
X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet

Hi, Mike,

Thank you for the help.

Would you please tell me where should I put
if(Response.IsC lientConnected)
{
//do something
}

Thank you

hb
""Mike Moore [MSFT]"" <mi****@online. microsoft.com> wrote in message
news:H$******** *****@cpmsftngx a06.phx.gbl...
Hi,

For the most part, your server will never know when the client browser is closed. Here are some very limited things you can do to tell if the client is still on your page (whether open or closed)

While your server is processing a request, if it takes a long time to
service that request, you can call Response.IsClie ntConnected to see if the
browser is still on your page.

You can add code to your page's client onunload event which could
notify your server that the page is unloading. This will not tell you if the
browser is being closed.
For example: <body onunload="alert ('closing');">

If you use this method, use showModalDialog to browse to a page which
notifies your server. That page will return JavaScript back to the

dialog with window.close(); .

Another option is that you could write an ActiveX control. However, that control will only exist so long as the user is on your page. You still
won't know if they close the browser.

Essentially, the internet was designed such that the server only knows
about the browser while it is processing a request from the browser. The rest of the time, the server is not aware of the browser.

Does this answer your question?

Thank you, Mike
Microsoft, ASP.NET Support Professional

Microsoft highly recommends to all of our customers that they visit the http://www.microsoft.com/protect site and perform the three

straightforward
steps listed to improve your computer's security.

This posting is provided "AS IS", with no warranties, and confers no

rights.


--------------------
> From: "hb" <ho****@goodoff ices.com>
> Subject: Help: How to detect if the browser is closed?
> Date: Mon, 17 Nov 2003 09:09:01 -0500
> Lines: 11
> X-Priority: 3
> X-MSMail-Priority: Normal
> X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
> Message-ID: <er************ **@TK2MSFTNGP10 .phx.gbl>
> Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
> NNTP-Posting-Host: x403446fe.ip.e-nt.net 64.52.70.254
> Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP10.phx.g bl
> Xref: cpmsftngxa06.ph x.gbl

microsoft.publi c.dotnet.framew ork.aspnet:1913 66
> X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
>
> Hi,
>
> Would you please tell me how to detect if the client's browser is

closed?
>
> I need such event to trigger a database modification.
>
> Thank you
>
> hb
>
>
>


Nov 18 '05 #5
Hi,

The internet (specifically the HTTP protocol) does not allow the server to
keep watch over the client. The things I've mentioned are what is available
for watching the client.

Thank you, Mike
Microsoft, ASP.NET Support Professional

Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three straightforward
steps listed to improve your computer’s security.

This posting is provided "AS IS", with no warranties, and confers no rights.
--------------------
From: "hb" <ho****@goodoff ices.com>
References: <er************ **@TK2MSFTNGP10 .phx.gbl> <H$************ *@cpmsftngxa06. phx.gbl>
<es************ **@TK2MSFTNGP12 .phx.gbl>
<nw************ **@cpmsftngxa06 .phx.gbl> Subject: Re: Help: How to detect if the browser is closed?
Date: Wed, 19 Nov 2003 10:41:06 -0500
Lines: 166
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <OR************ **@TK2MSFTNGP12 .phx.gbl>
Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
NNTP-Posting-Host: x403446fe.ip.e-nt.net 64.52.70.254
Path: cpmsftngxa07.ph x.gbl!cpmsftngx a10.phx.gbl!TK2 MSFTNGXA05.phx. gbl!TK2MSFTNGP0 8
..phx.gbl!TK2MS FTNGP12.phx.gbl Xref: cpmsftngxa07.ph x.gbl microsoft.publi c.dotnet.framew ork.aspnet:1912 49
X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet

Hi, Mike,

I have tried the method provided by the article Q182892.

The IsClientConnect will become false when either the browser is closed or
the user is redirected to another URL. I tried to use Request.Url to catch
the
new URL after IsClientConnect =false, but the URL I caught stay the same.

Plus, the process uses about 70% CPU. So this method cannot be use in
production code.

What I am looking for is a way that can allow me to detect if the browser
gets closed or
if user gets redirected to another URL that has different domain. The result of such detection
triggers a modification in database.

Would you please give me some ideas?

Thank you

hb
""Mike Moore [MSFT]"" <mi****@online. microsoft.com> wrote in message
news:nw******** ******@cpmsftng xa06.phx.gbl...
Hi,

Here's an article that describes usage of IsClientConnect ed and includes a
code sample. It's old ASP code, but the concept remains the same.

182892 HOWTO: Use IsClientConnect ed to Check If Browser Is Connected
http://kb/article.asp?id=Q182892

Thank you, Mike
Microsoft, ASP.NET Support Professional

Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three

straightforward
steps listed to improve your computer's security.

This posting is provided "AS IS", with no warranties, and confers no

rights.


--------------------
From: "hb" <ho****@goodoff ices.com>
References: <er************ **@TK2MSFTNGP10 .phx.gbl>

<H$************ *@cpmsftngxa06. phx.gbl>
Subject: Re: Help: How to detect if the browser is closed?
Date: Mon, 17 Nov 2003 16:52:19 -0500
Lines: 90
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <es************ **@TK2MSFTNGP12 .phx.gbl>
Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
NNTP-Posting-Host: x403446fe.ip.e-nt.net 64.52.70.254
Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP12.phx.g bl
Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.framew ork.aspnet:1915 30 X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet

Hi, Mike,

Thank you for the help.

Would you please tell me where should I put
if(Response.IsC lientConnected)
{
//do something
}

Thank you

hb
""Mike Moore [MSFT]"" <mi****@online. microsoft.com> wrote in message
news:H$******** *****@cpmsftngx a06.phx.gbl...
> Hi,
>
> For the most part, your server will never know when the client browser is
> closed. Here are some very limited things you can do to tell if the

client
> is still on your page (whether open or closed)
>
> While your server is processing a request, if it takes a long time
to > service that request, you can call Response.IsClie ntConnected to see

if the
> browser is still on your page.
>
> You can add code to your page's client onunload event which could notify > your server that the page is unloading. This will not tell you if the > browser is being closed.
> For example: <body onunload="alert ('closing');">
>
> If you use this method, use showModalDialog to browse to a page which > notifies your server. That page will return JavaScript back to the

dialog
> with window.close(); .
>
> Another option is that you could write an ActiveX control. However, that > control will only exist so long as the user is on your page. You still > won't know if they close the browser.
>
> Essentially, the internet was designed such that the server only knows > about the browser while it is processing a request from the browser. The > rest of the time, the server is not aware of the browser.
>
> Does this answer your question?
>
> Thank you, Mike
> Microsoft, ASP.NET Support Professional
>
> Microsoft highly recommends to all of our customers that they visit the > http://www.microsoft.com/protect site and perform the three
straightforward
> steps listed to improve your computer's security.
>
> This posting is provided "AS IS", with no warranties, and confers no
rights.
>
>
> --------------------
> > From: "hb" <ho****@goodoff ices.com>
> > Subject: Help: How to detect if the browser is closed?
> > Date: Mon, 17 Nov 2003 09:09:01 -0500
> > Lines: 11
> > X-Priority: 3
> > X-MSMail-Priority: Normal
> > X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
> > X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
> > Message-ID: <er************ **@TK2MSFTNGP10 .phx.gbl>
> > Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
> > NNTP-Posting-Host: x403446fe.ip.e-nt.net 64.52.70.254
> > Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP10.phx.g bl > > Xref: cpmsftngxa06.ph x.gbl
microsoft.publi c.dotnet.framew ork.aspnet:1913 66
> > X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
> >
> > Hi,
> >
> > Would you please tell me how to detect if the client's browser is
closed?
> >
> > I need such event to trigger a database modification.
> >
> > Thank you
> >
> > hb
> >
> >
> >
>



Nov 18 '05 #6
hb
I got it.

Thank you for the help!

hb
""Mike Moore [MSFT]"" <mi****@online. microsoft.com> wrote in message
news:Ec******** ******@cpmsftng xa07.phx.gbl...
Hi,

The internet (specifically the HTTP protocol) does not allow the server to
keep watch over the client. The things I've mentioned are what is available for watching the client.

Thank you, Mike
Microsoft, ASP.NET Support Professional

Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three straightforward steps listed to improve your computer's security.

This posting is provided "AS IS", with no warranties, and confers no rights.

--------------------
From: "hb" <ho****@goodoff ices.com>
References: <er************ **@TK2MSFTNGP10 .phx.gbl> <H$************ *@cpmsftngxa06. phx.gbl>
<es************ **@TK2MSFTNGP12 .phx.gbl>
<nw************ **@cpmsftngxa06 .phx.gbl>
Subject: Re: Help: How to detect if the browser is closed?
Date: Wed, 19 Nov 2003 10:41:06 -0500
Lines: 166
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <OR************ **@TK2MSFTNGP12 .phx.gbl>
Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
NNTP-Posting-Host: x403446fe.ip.e-nt.net 64.52.70.254
Path:

cpmsftngxa07.ph x.gbl!cpmsftngx a10.phx.gbl!TK2 MSFTNGXA05.phx. gbl!TK2MSFTNGP0 8 phx.gbl!TK2MSFT NGP12.phx.gbl
Xref: cpmsftngxa07.ph x.gbl microsoft.publi c.dotnet.framew ork.aspnet:1912 49
X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet

Hi, Mike,

I have tried the method provided by the article Q182892.

The IsClientConnect will become false when either the browser is closed or the user is redirected to another URL. I tried to use Request.Url to catch the
new URL after IsClientConnect =false, but the URL I caught stay the same.

Plus, the process uses about 70% CPU. So this method cannot be use in
production code.

What I am looking for is a way that can allow me to detect if the browser gets closed or
if user gets redirected to another URL that has different domain. The

result
of such detection
triggers a modification in database.

Would you please give me some ideas?

Thank you

hb
""Mike Moore [MSFT]"" <mi****@online. microsoft.com> wrote in message
news:nw******** ******@cpmsftng xa06.phx.gbl...
Hi,

Here's an article that describes usage of IsClientConnect ed and includes a code sample. It's old ASP code, but the concept remains the same.

182892 HOWTO: Use IsClientConnect ed to Check If Browser Is Connected
http://kb/article.asp?id=Q182892

Thank you, Mike
Microsoft, ASP.NET Support Professional

Microsoft highly recommends to all of our customers that they visit the http://www.microsoft.com/protect site and perform the three

straightforward
steps listed to improve your computer's security.

This posting is provided "AS IS", with no warranties, and confers no

rights.


--------------------
> From: "hb" <ho****@goodoff ices.com>
> References: <er************ **@TK2MSFTNGP10 .phx.gbl>
<H$************ *@cpmsftngxa06. phx.gbl>
> Subject: Re: Help: How to detect if the browser is closed?
> Date: Mon, 17 Nov 2003 16:52:19 -0500
> Lines: 90
> X-Priority: 3
> X-MSMail-Priority: Normal
> X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
> Message-ID: <es************ **@TK2MSFTNGP12 .phx.gbl>
> Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
> NNTP-Posting-Host: x403446fe.ip.e-nt.net 64.52.70.254
> Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP12.phx.g bl
> Xref: cpmsftngxa06.ph x.gbl

microsoft.publi c.dotnet.framew ork.aspnet:1915 30
> X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
>
> Hi, Mike,
>
> Thank you for the help.
>
> Would you please tell me where should I put
> if(Response.IsC lientConnected)
> {
> //do something
> }
>
> Thank you
>
> hb
> ""Mike Moore [MSFT]"" <mi****@online. microsoft.com> wrote in message
> news:H$******** *****@cpmsftngx a06.phx.gbl...
> > Hi,
> >
> > For the most part, your server will never know when the client browser is
> > closed. Here are some very limited things you can do to tell if the client
> > is still on your page (whether open or closed)
> >
> > While your server is processing a request, if it takes a long time to > > service that request, you can call Response.IsClie ntConnected to see if
> the
> > browser is still on your page.
> >
> > You can add code to your page's client onunload event which could

notify
> > your server that the page is unloading. This will not tell you if the > > browser is being closed.
> > For example: <body onunload="alert ('closing');">
> >
> > If you use this method, use showModalDialog to browse to a page which > > notifies your server. That page will return JavaScript back to the
dialog
> > with window.close(); .
> >
> > Another option is that you could write an ActiveX control.
However,
that
> > control will only exist so long as the user is on your page. You still > > won't know if they close the browser.
> >
> > Essentially, the internet was designed such that the server only knows > > about the browser while it is processing a request from the
browser. The
> > rest of the time, the server is not aware of the browser.
> >
> > Does this answer your question?
> >
> > Thank you, Mike
> > Microsoft, ASP.NET Support Professional
> >
> > Microsoft highly recommends to all of our customers that they
visit the
> > http://www.microsoft.com/protect site and perform the three
> straightforward
> > steps listed to improve your computer's security.
> >
> > This posting is provided "AS IS", with no warranties, and confers

no > rights.
> >
> >
> > --------------------
> > > From: "hb" <ho****@goodoff ices.com>
> > > Subject: Help: How to detect if the browser is closed?
> > > Date: Mon, 17 Nov 2003 09:09:01 -0500
> > > Lines: 11
> > > X-Priority: 3
> > > X-MSMail-Priority: Normal
> > > X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
> > > X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
> > > Message-ID: <er************ **@TK2MSFTNGP10 .phx.gbl>
> > > Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
> > > NNTP-Posting-Host: x403446fe.ip.e-nt.net 64.52.70.254
> > > Path:

cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP10.phx.g bl > > > Xref: cpmsftngxa06.ph x.gbl
> microsoft.publi c.dotnet.framew ork.aspnet:1913 66
> > > X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
> > >
> > > Hi,
> > >
> > > Would you please tell me how to detect if the client's browser is > closed?
> > >
> > > I need such event to trigger a database modification.
> > >
> > > Thank you
> > >
> > > hb
> > >
> > >
> > >
> >
>
>
>


Nov 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
29350
by: sm mehta | last post by:
Hi, I have a web Application that must be licensed. When Customer buys 2 licensees for my application they can only have 2 copies open at a time. What I am doing right now is, I am storing No. Of License in the SQL Table, and on each connection i would reduce 1 license from the DB. My problem is when user closes IE Browser, I want to capture this event and return the license to the DB. How do I know when user closed the browser? I have...
3
4262
by: Lord2702 | last post by:
Sat. Oct. 30, 2004 3:25 PM PT I want to detect, if user has close the browser, (after logging to my site), that user has closed the browser. How to achieve it ? I want to know this close action on my server-side code. Because if he logout by clicking on Logout/ Sign-Off button it simple to get the message. Although, this is very similar to the first above. Also, if user takes any action on client-side or browser side how will I detect...
7
2163
by: Chris | last post by:
Can anybody tell me how to detect is the user has closed the browser Thank you
6
1532
by: Pekka Karjalainen | last post by:
Python 2.4.1 (#1, May 16 2005, 15:19:29) on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from sys import stdout >>> help (stdout.closed) If I do this, it gives me help on the bool object. Also: >>> stdout.closed.__doc__ 'bool(x) -> bool\n\nReturns True when the argument x is true, False
1
4731
by: bloodandrose | last post by:
Can you help me How to detect browser close event? Thanks
1
5228
by: kaushalmbhavsar | last post by:
Hi I have couple of pages that maintain some stateful information and i need to detect browser back/refresh button press and loged out user. Is there a simple mechanims in .NET (specially in ASP.NET) to detech the same? Thanks in advance regards, KB
2
2228
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= | last post by:
I see a lot of posts claiming that you can use AJAX or Javascript to run some kind of "heartbeat" " server polling" that tells the server that the page is still open. I need to know how exactly to do this (server side and client side) or where I can find information on doing this. I want to run some code after a page is closed and I don't want to wait for the session timeout. if anyone has information please post explanations, code...
1
2781
by: mmr315 | last post by:
how to destroy session when browser closed with out logout.pls hlp me
1
3723
by: soni2926 | last post by:
hi, i'm working on a site, which has a session created after a user logins, each page checks to make sure the session is there onload otherwise redirects to the login page. now the clients are asking us to make a remember me feature, is there any way to do this with the existing session set up? or do i need to rework it, as remember me from what i was planning was going to drop a cookie, so do i need change all those session checks to...
2
8561
by: tokcy | last post by:
Hi All, I want to kip session alive until i closed the browser. Default session time 30 minutes and if we are using session.gc_maxlifetime then i have to give specific time like 8 hrs or something like this. And i want to keep alive for all time till browser closed. Thanks in Advance.
0
8888
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8752
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9401
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9176
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9113
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8097
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6011
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
2635
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.