how to detect Browser close event.

Discussion in 'ASP .Net' started by sm mehta, Jul 29, 2003.

  1. sm mehta

    sm mehta Guest

    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 more than one page in my application so from any page if
    they close browser I should capture that event. I also have Automatic
    refresh on couple of pages where it redraws pages from the DB every 5
    mins. I should not clear the license upon refresh. I would really
    appreciate your help.

    Thanks
    SM.


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    sm mehta, Jul 29, 2003
    #1
    1. Advertising

  2. sm mehta

    David Guest

    There's an event in your global.ascx that triggers when a
    session ends. You might want to try updating your DB here.

    Sub Session_End(ByVal sender As Object, ByVal e As
    EventArgs)
    ' Fires when the session ends
    End Sub

    >-----Original Message-----
    >
    >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 more than one page in my application so

    from any page if
    >they close browser I should capture that event. I also

    have Automatic
    >refresh on couple of pages where it redraws pages from

    the DB every 5
    >mins. I should not clear the license upon refresh. I

    would really
    >appreciate your help.
    >
    >Thanks
    >SM.
    >
    >
    >*** Sent via Developersdex http://www.developersdex.com

    ***
    >Don't just participate in USENET...get rewarded for it!
    >.
    >
     
    David, Jul 29, 2003
    #2
    1. Advertising

  3. sm mehta

    Natty Gur Guest

    In addition to David replay,

    pay attention that the default session ending is 20 minutes after the
    user last request to the server, you can change it in the web.config.

    Natty Gur, CTO
    Dao2Com Ltd.
    28th Baruch Hirsch st. Bnei-Brak
    Israel , 51114

    Phone Numbers:
    Office: +972-(0)3-5786668
    Fax: +972-(0)3-5703475
    Mobile: +972-(0)58-888377

    Know the overall picture


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Natty Gur, Jul 29, 2003
    #3
  4. sm mehta

    bruce barker Guest

    there is no way to reliably catch this event on the server. as the browser
    doesn't maintain a connection to your server, you can only guess at number
    of concurrent users.

    you will need to implement a license checkout scheme. every page request
    need to check out a license, that has a short timeout. if none availiable
    then report error. on postback the page send the license, if its still vaild
    or an additional one is available, the post succeeds, otherwise report out
    of license error. the postback will also release the license. if the
    postback renders a new page, a new checkout is done.

    -- bruce (sqlwork)


    "sm mehta" <> wrote in message
    news:...
    >
    > 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 more than one page in my application so from any page if
    > they close browser I should capture that event. I also have Automatic
    > refresh on couple of pages where it redraws pages from the DB every 5
    > mins. I should not clear the license upon refresh. I would really
    > appreciate your help.
    >
    > Thanks
    > SM.
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
     
    bruce barker, Jul 29, 2003
    #4
  5. You may be able to take advantage of the client side OnClose event.
    Here's more info:
    http://www.mozilla.org/docs/dom/domref/dom_window_ref56.html

    --
    I hope this helps,
    Steve C. Orr, MCSD
    http://Steve.Orr.net


    "sm mehta" <> wrote in message
    news:...
    >
    > 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 more than one page in my application so from any page if
    > they close browser I should capture that event. I also have Automatic
    > refresh on couple of pages where it redraws pages from the DB every 5
    > mins. I should not clear the license upon refresh. I would really
    > appreciate your help.
    >
    > Thanks
    > SM.
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
     
    Steve C. Orr, MCSD, Jul 29, 2003
    #5
    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. Lord2702
    Replies:
    3
    Views:
    663
  2. Iñaki Baz Castillo
    Replies:
    7
    Views:
    918
    Iñaki Baz Castillo
    Jan 12, 2010
  3. Replies:
    1
    Views:
    325
    Evertjan.
    Aug 9, 2006
  4. Replies:
    0
    Views:
    527
  5. Mike Scirocco
    Replies:
    4
    Views:
    285
    Mike Scirocco
    Apr 5, 2007
Loading...

Share This Page