How to trap browser close event in SERVER side?

Discussion in 'ASP .Net' started by Denon, Nov 7, 2003.

  1. Denon

    Denon Guest

    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
     
    Denon, Nov 7, 2003
    #1
    1. Advertising

  2. > 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" <> wrote in message
    news:%23K7hr$...
    > 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
    >
    >
     
    Kevin Spencer, Nov 7, 2003
    #2
    1. Advertising

  3. You can use the IsClientConnected property of the Response object.
    It can be useful to check for user still connected for "heavy" tasks to
    complete.

    Luca

    "Denon" <> wrote in message
    news:#K7hr$...
    > 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
    >
    >
     
    Luca Bertoldi, Nov 7, 2003
    #3
  4. Denon

    Ed Crowley Guest

    "Kevin Spencer" <> wrote in message
    news:%23%23%...
    > > 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?
     
    Ed Crowley, Nov 7, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. walterd
    Replies:
    1
    Views:
    3,487
    Eliyahu Goldin
    Jul 20, 2004
  2. Replies:
    0
    Views:
    471
  3. Guest

    Fire server side event before client side event

    Guest, Mar 17, 2005, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    622
    Ken Cox [Microsoft MVP]
    Mar 18, 2005
  4. Iñaki Baz Castillo
    Replies:
    7
    Views:
    919
    Iñaki Baz Castillo
    Jan 12, 2010
  5. Replies:
    0
    Views:
    528
Loading...

Share This Page