472,357 Members | 1,937 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,357 software developers and data experts.

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 5116
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.IsClientConnected 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****@goodoffices.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.public.dotnet.framework.aspnet
NNTP-Posting-Host: x403446fe.ip.e-nt.net 64.52.70.254
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP10.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:191366
X-Tomcat-NG: microsoft.public.dotnet.framework.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.IsClientConnected)
{
//do something
}

Thank you

hb
""Mike Moore [MSFT]"" <mi****@online.microsoft.com> wrote in message
news:H$*************@cpmsftngxa06.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.IsClientConnected 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****@goodoffices.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.public.dotnet.framework.aspnet
NNTP-Posting-Host: x403446fe.ip.e-nt.net 64.52.70.254
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP10.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:191366 X-Tomcat-NG: microsoft.public.dotnet.framework.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 IsClientConnected and includes a
code sample. It's old ASP code, but the concept remains the same.

182892 HOWTO: Use IsClientConnected 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****@goodoffices.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.public.dotnet.framework.aspnet
NNTP-Posting-Host: x403446fe.ip.e-nt.net 64.52.70.254
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP12.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:191530
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

Hi, Mike,

Thank you for the help.

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

Thank you

hb
""Mike Moore [MSFT]"" <mi****@online.microsoft.com> wrote in message
news:H$*************@cpmsftngxa06.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.IsClientConnected 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****@goodoffices.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.public.dotnet.framework.aspnet
NNTP-Posting-Host: x403446fe.ip.e-nt.net 64.52.70.254
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP10.phx.gbl
Xref: cpmsftngxa06.phx.gbl

microsoft.public.dotnet.framework.aspnet:191366 X-Tomcat-NG: microsoft.public.dotnet.framework.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**************@cpmsftngxa06.phx.gbl...
Hi,

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

182892 HOWTO: Use IsClientConnected 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****@goodoffices.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.public.dotnet.framework.aspnet
NNTP-Posting-Host: x403446fe.ip.e-nt.net 64.52.70.254
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP12.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:191530
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

Hi, Mike,

Thank you for the help.

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

Thank you

hb
""Mike Moore [MSFT]"" <mi****@online.microsoft.com> wrote in message
news:H$*************@cpmsftngxa06.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.IsClientConnected 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****@goodoffices.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.public.dotnet.framework.aspnet
> NNTP-Posting-Host: x403446fe.ip.e-nt.net 64.52.70.254
> Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP10.phx.gbl
> Xref: cpmsftngxa06.phx.gbl

microsoft.public.dotnet.framework.aspnet:191366
> X-Tomcat-NG: microsoft.public.dotnet.framework.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****@goodoffices.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.public.dotnet.framework.aspnet
NNTP-Posting-Host: x403446fe.ip.e-nt.net 64.52.70.254
Path: cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTN GXA05.phx.gbl!TK2MSFTNGP08
..phx.gbl!TK2MSFTNGP12.phx.gbl Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.framework.aspnet:191249
X-Tomcat-NG: microsoft.public.dotnet.framework.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**************@cpmsftngxa06.phx.gbl...
Hi,

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

182892 HOWTO: Use IsClientConnected 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****@goodoffices.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.public.dotnet.framework.aspnet
NNTP-Posting-Host: x403446fe.ip.e-nt.net 64.52.70.254
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP12.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:191530 X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

Hi, Mike,

Thank you for the help.

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

Thank you

hb
""Mike Moore [MSFT]"" <mi****@online.microsoft.com> wrote in message
news:H$*************@cpmsftngxa06.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.IsClientConnected 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****@goodoffices.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.public.dotnet.framework.aspnet
> > NNTP-Posting-Host: x403446fe.ip.e-nt.net 64.52.70.254
> > Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP10.phx.gbl > > Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.aspnet:191366
> > X-Tomcat-NG: microsoft.public.dotnet.framework.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**************@cpmsftngxa07.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****@goodoffices.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.public.dotnet.framework.aspnet
NNTP-Posting-Host: x403446fe.ip.e-nt.net 64.52.70.254
Path:

cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTN GXA05.phx.gbl!TK2MSFTNGP08 phx.gbl!TK2MSFTNGP12.phx.gbl
Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.framework.aspnet:191249
X-Tomcat-NG: microsoft.public.dotnet.framework.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**************@cpmsftngxa06.phx.gbl...
Hi,

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

182892 HOWTO: Use IsClientConnected 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****@goodoffices.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.public.dotnet.framework.aspnet
> NNTP-Posting-Host: x403446fe.ip.e-nt.net 64.52.70.254
> Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP12.phx.gbl
> Xref: cpmsftngxa06.phx.gbl

microsoft.public.dotnet.framework.aspnet:191530
> X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
>
> Hi, Mike,
>
> Thank you for the help.
>
> Would you please tell me where should I put
> if(Response.IsClientConnected)
> {
> //do something
> }
>
> Thank you
>
> hb
> ""Mike Moore [MSFT]"" <mi****@online.microsoft.com> wrote in message
> news:H$*************@cpmsftngxa06.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.IsClientConnected 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****@goodoffices.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.public.dotnet.framework.aspnet
> > > NNTP-Posting-Host: x403446fe.ip.e-nt.net 64.52.70.254
> > > Path:

cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP10.phx.gbl > > > Xref: cpmsftngxa06.phx.gbl
> microsoft.public.dotnet.framework.aspnet:191366
> > > X-Tomcat-NG: microsoft.public.dotnet.framework.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
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....
3
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...
7
by: Chris | last post by:
Can anybody tell me how to detect is the user has closed the browser Thank you
6
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...
1
by: bloodandrose | last post by:
Can you help me How to detect browser close event? Thanks
1
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...
2
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...
1
by: mmr315 | last post by:
how to destroy session when browser closed with out logout.pls hlp me
1
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...
2
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...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
1
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. header("Location:".$urlback); Is this the right layout the...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
0
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...

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.