Results 1 to 7 of 7

Thread: Active Users

  1. #1

    Thread Starter
    PowerPoster Beacon's Avatar
    Join Date
    Jan 2001
    Location
    Pub Floor
    Posts
    3,188

    Active Users

    Hey All,

    What is the easiest and best way to record who is logged in and online?

    Any ideas\examples would be great.
    ciao
    b

  2. #2
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Malaysia
    Posts
    345
    Bring database into picture.

    When ever a user logs in add an entry to a table..(like userid,user name, session id etc)

    when the user logs out delete his/her entry from the table
    Thanks.

  3. #3
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Newbury, UK
    Posts
    1,878
    It is VERY tricky to identify who is an active user.

    Someone who has not touched their keyboard for 2 hours? or 10 minutes? or 2 minutes?
    You can check on when someone logs on. But what happens when they go away - turn the PC off, logout, walk away without logging out, go to a 3 hour meeting etc.

    Then you have the problems of logged in to where? The Windows NT / 2000 domain (one multiple Domain Controllers)? A particular server? An application (like Exchange) on a server?

    Some applications are "stateless". It doesn't matter where you were before, this latest request is a unique one (e.g. an HTTP page request). This means that once the request has been responded to, the user is no longer logged in and active - even if they hit another page within 5 seconds.

  4. #4

    Thread Starter
    PowerPoster Beacon's Avatar
    Join Date
    Jan 2001
    Location
    Pub Floor
    Posts
    3,188
    siha thats not easy as it's in asp how do you know when they have left your site or closed the browser and how do you get it to delete or alter the record when they leave?

    JordanChris:

    Yes i've found that out i cant do it via the global.asa file as the session_onstart is called before they login.

    Anyone??

  5. #5
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Malaysia
    Posts
    345
    Hi!

    You should alter the table(deleting the record of that user) at two locations:

    First is obviously at the log out page.

    Now, when the User logs in, you should store his/her Id in a session variable.

    Alter the table(deleting the record of user) at Session_OnEnd of global.asa based on Id stored in the session variable

    If a User doesn't log out and closes his/her browser instead, then Session_OnEnd will fire depending upon the session timeout you have specified.

    So, if the Session time out is set for say 10 mins then, the user's record will be deleted from the table after 10 mins.

    But, yes..again this method is also not foolproof as you won't get the exact no. of ACTIVE USERS.

    I'm really looking forward to the full proof solution of it.
    Thanks.

  6. #6
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Malaysia
    Posts
    345
    This might solve the problem when the user closes the browser instead of logging out..


    On onunload event handler in the body of the page call a function which in turn calls a special page which clears all session variables, logs the user out, etc.
    Thanks.

  7. #7
    Lively Member
    Join Date
    Aug 2002
    Location
    Jordan
    Posts
    74
    Make two array that you can check over the whole application.
    The first array will contain the sessionIDs of logged in users (simply use Global.Asa to know when someone enters the application).
    Then the second array will hold the corresponding user names when they log in.
    Use Global.Asa again to know when the user logged out (And delete the values from the arrays)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width