|
-
Mar 25th, 2003, 11:33 PM
#1
Thread Starter
PowerPoster
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
-
Mar 26th, 2003, 01:12 AM
#2
Hyperactive Member
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
-
Mar 26th, 2003, 09:13 AM
#3
Frenzied Member
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.
-
Mar 26th, 2003, 08:09 PM
#4
Thread Starter
PowerPoster
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??
-
Mar 27th, 2003, 04:44 AM
#5
Hyperactive Member
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.
-
Mar 27th, 2003, 11:02 PM
#6
Hyperactive Member
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.
-
Mar 28th, 2003, 07:31 AM
#7
Lively Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|