Need help keeping track of users "online" (i.e. viewing the web si

Discussion in 'ASP .Net' started by =?Utf-8?B?dHBlcnJp?=, Jul 11, 2005.

  1. I've got a user table with a field called Online, and when a user logs in, I
    set a value in this column to indicate they are online. And in the same
    fashion, when they click the logout button, I update this same field to
    indicate they are offline.

    However, how do I handle this when a user just X's out of the browser
    without logging off? I've set break points in the global.asax.cs file but
    the Session_End and Application_End functions never get executed if the
    browser is closed.

    Can anyone recommend a better solution for me, or tell me how to execute
    updating my code to set a user offline if someone exits closing the browser
    or navigating away from my page?

    Thanks for the help.
     
    =?Utf-8?B?dHBlcnJp?=, Jul 11, 2005
    #1
    1. Advertising

  2. Session end doesn't happen when the browser closes, it happens when the
    server times out the session due to session inactivity. Are you perhaps
    expecting the session end to fire on browser close?

    --
    Regards

    John Timney
    ASP.NET MVP
    Microsoft Regional Director

    "tperri" <> wrote in message
    news:...
    > I've got a user table with a field called Online, and when a user logs in,
    > I
    > set a value in this column to indicate they are online. And in the same
    > fashion, when they click the logout button, I update this same field to
    > indicate they are offline.
    >
    > However, how do I handle this when a user just X's out of the browser
    > without logging off? I've set break points in the global.asax.cs file but
    > the Session_End and Application_End functions never get executed if the
    > browser is closed.
    >
    > Can anyone recommend a better solution for me, or tell me how to execute
    > updating my code to set a user offline if someone exits closing the
    > browser
    > or navigating away from my page?
    >
    > Thanks for the help.
     
    John Timney \(ASP.NET MVP\), Jul 11, 2005
    #2
    1. Advertising

  3. Re: Need help keeping track of users "online" (i.e. viewing the we

    Actually I'm looking for anything that fires when the browser is closed or my
    page is navigated away from.

    Can you point me in the direction of what I'm looking for?

    Thanks for your response

    "John Timney (ASP.NET MVP)" wrote:

    > Session end doesn't happen when the browser closes, it happens when the
    > server times out the session due to session inactivity. Are you perhaps
    > expecting the session end to fire on browser close?
    >
    > --
    > Regards
    >
    > John Timney
    > ASP.NET MVP
    > Microsoft Regional Director
    >
    > "tperri" <> wrote in message
    > news:...
    > > I've got a user table with a field called Online, and when a user logs in,
    > > I
    > > set a value in this column to indicate they are online. And in the same
    > > fashion, when they click the logout button, I update this same field to
    > > indicate they are offline.
    > >
    > > However, how do I handle this when a user just X's out of the browser
    > > without logging off? I've set break points in the global.asax.cs file but
    > > the Session_End and Application_End functions never get executed if the
    > > browser is closed.
    > >
    > > Can anyone recommend a better solution for me, or tell me how to execute
    > > updating my code to set a user offline if someone exits closing the
    > > browser
    > > or navigating away from my page?
    > >
    > > Thanks for the help.

    >
    >
    >
     
    =?Utf-8?B?dHBlcnJp?=, Jul 11, 2005
    #3
  4. Patrick Olurotimi Ige, Jul 12, 2005
    #4
  5. Re: Need help keeping track of users "online" (i.e. viewing the we

    Hi
    not sure if this was answered in the link Patrick gave as I couldn't follow
    the link

    here's something to try
    Set Session.Timeout = 2 in the Session Start Event
    In your Session End event add in a few dummy lines of code and set a break
    point
    Now start in debugging mode and either leave your browser on the page that
    comes up or navigate to a different site altogether
    switch back to VisualStudio.NET
    wait 2 minutes then hey presto the break point should be hit
    If you want to use any session variables in the End event just initalise
    them in the the start event, if you dont they seem to go missing

    It also works for when users X out of the browser

    Cheers

    Felix
     
    =?Utf-8?B?Rng=?=, Jul 12, 2005
    #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. John
    Replies:
    0
    Views:
    369
  2. Utter Newbie
    Replies:
    0
    Views:
    478
    Utter Newbie
    Jul 28, 2003
  3. Anders Steinlein

    Keeping track of online users

    Anders Steinlein, Apr 20, 2004, in forum: Java
    Replies:
    0
    Views:
    377
    Anders Steinlein
    Apr 20, 2004
  4. Eric S

    Keeping track of users LogIn

    Eric S, Mar 2, 2010, in forum: ASP .Net
    Replies:
    5
    Views:
    813
    Eric S
    Mar 2, 2010
  5. Jack
    Replies:
    1
    Views:
    135
    dNagel
    Feb 24, 2006
Loading...

Share This Page