473,739 Members | 9,109 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to trap browser close event in SERVER side?

How to trap browser close event in SERVER side?
I read a lot of forum message, it talk about onclose(), onunload() and even
onbeforeunload( ) event. However, all of theses are based on javascript
written on the client browser , like IE. To send a POST to web server to
acknowledge its close event.

However, I just think, web server and client browser is a TCP connection.
And if the client browser is close and it imply the TCP socket is broken.
The web should detect the connection lost, Right? Is there any method that
the web server(server side) can detect this?

I'm cope for ASP.NET solution with IE browser as majority.

Thanks for any help

Den
Nov 17 '05 #1
3 11226
> However, I just think, web server and client browser is a TCP connection.
And if the client browser is close and it imply the TCP socket is broken.
The web should detect the connection lost, Right? Is there any method that
the web server(server side) can detect this?
HTTP is stateless. There is no persistent connection between browser and
server. Therefore, no, there is no method to do what you want.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big Things are made up of
Lots of Little Things.

"Denon" <de****@icqmail .com> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. .. How to trap browser close event in SERVER side?
I read a lot of forum message, it talk about onclose(), onunload() and even onbeforeunload( ) event. However, all of theses are based on javascript
written on the client browser , like IE. To send a POST to web server to
acknowledge its close event.

However, I just think, web server and client browser is a TCP connection.
And if the client browser is close and it imply the TCP socket is broken.
The web should detect the connection lost, Right? Is there any method that
the web server(server side) can detect this?

I'm cope for ASP.NET solution with IE browser as majority.

Thanks for any help

Den

Nov 17 '05 #2
You can use the IsClientConnect ed property of the Response object.
It can be useful to check for user still connected for "heavy" tasks to
complete.

Luca

"Denon" <de****@icqmail .com> wrote in message
news:#K******** ******@TK2MSFTN GP12.phx.gbl...
How to trap browser close event in SERVER side?
I read a lot of forum message, it talk about onclose(), onunload() and even onbeforeunload( ) event. However, all of theses are based on javascript
written on the client browser , like IE. To send a POST to web server to
acknowledge its close event.

However, I just think, web server and client browser is a TCP connection.
And if the client browser is close and it imply the TCP socket is broken.
The web should detect the connection lost, Right? Is there any method that
the web server(server side) can detect this?

I'm cope for ASP.NET solution with IE browser as majority.

Thanks for any help

Den

Nov 17 '05 #3

"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:%2******** ************@TK 2MSFTNGP10.phx. gbl...
However, I just think, web server and client browser is a TCP connection. And if the client browser is close and it imply the TCP socket is broken. The web should detect the connection lost, Right? Is there any method that the web server(server side) can detect this?


HTTP is stateless. There is no persistent connection between browser and
server. Therefore, no, there is no method to do what you want.


Could you not use Javascript to catch the browser window close event to
launch another page that would inform the server?
Nov 17 '05 #4

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

Similar topics

2
309
by: david | last post by:
(1) How do I update the IE browser's status bar from within an ASP.NET web application? (2) How can I capture the event of closing the IE browser from within an ASP.NET web application? (3) How can I suspend any activity - disable accepting keyboard or mouse clicks on a web page until the client request is processed by an IIS server.
1
1892
by: feng | last post by:
Hi, When user closes a browser window by clicking on the "X" button, I want the server to be noticed (either through postback or calling other ASP pages, etc.) and perform some task accordingly. Please note that I can't use session end event, since the session is still alive now and the user is just closing a secondary window he/she opened.
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...
5
9126
by: news.microsoft.com | last post by:
Hi everyone, I need some help (may be in the form of some sample code) for the subject question. I have an ASP.NET/C# application. I need to do quite a few tasks when the session ends. I don't want to depend on the session timeout factor since it may end too soon or it may hang around too long. I can't find any event that fires when the browser closes. The Session_End event handler in the Global.asax does not execute until the...
4
4811
by: Bill Manring | last post by:
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,
9
3346
by: WRH | last post by:
Hello I am new to asp but I made some Jscript functions which work fine. The functions contain some strings used as a registration key for some apps. It is important that these strings not be visible to a client using a browser. My question is...can a knowledgeable browser user view Jscript source code in an asp file?
2
10098
by: David McDivitt | last post by:
Another fellow here must modify an application. On the web page, pressing the enter key causes the form to submit. What users want is to remove enter key functionality from within a textarea and cause the enter key to submit the form, AND cause the F6 key to do what the enter key used to do inside the text area. The idea I suggested is to trap keystrokes in the text area, If the enter key is pressed, do the submit method. If F6 is pressed,...
3
2954
by: Gouri.Mahajan7 | last post by:
Hello, I am new to asp.net. Can anybody please tell me which event is fired when we close the browser. I want to remove some resources when the browser close button is pressed. Thanks in advance. Regards, Gouri.
0
8969
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
8792
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
9479
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...
0
9209
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
8215
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
6054
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();...
0
4826
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2193
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.