Tracking logged username through database and session id
It would be nice to be able to see the users who are logged on to the site
for example
logged user : John,Smith,Charles,Tobi
and when the user logged out or the session ends ,the user will be removed from the list
Comments
User tracking
You can have a simply table which has 4 columns, 1 for ID, 2 for UserID, 3 for time logged in, 4 for time logged out
When the User logs in, have the Log in behaviour go to a intermediate page which contains a Command to update this table, Insert the UsersID from your Users table, filtered on the Username (use a recordset to provide this), then the Logged in column set to getdate().
Then use a Redirect to move to the home page, this will happen almost instantly, so the user will not notice.
Then on the log out link/page do the opposite, link to an intermediate page which updates the table, based on the UserID, and simply inserted getdate() into the logged out column.
You can then create a page to query this table to see who is on, and simply only show records where the Logged out column <> "" and < getdate()
Hope this helps
How to track LogOut on window close
Hi,
How can you track the LogOut if the user closes the window?
Thanks
You must me logged in to write a comment.