I'm developing a system in which I need to recover all users logged in or logged on to the server.
Context: When the user logs in to the system, in addition to creating the session , I save the information with the logon date and session time in the database.
Session["exemplo"] = exemplo;
When the user logs off, I drop the session and change the information in the database. Following this structure, I can have all users logged in "in hands". The problem that occurs to me is when the user is idle and the session automatically drops or when the user closes the browser. That way I can no longer change the status of the same in the database.
I would like to know if there is a way to retrieve all the active sessions on a server, ie recover all the users that are still logged into the system and their sessions have not yet expired? p>
Has anyone ever done anything similar?