Saturday, May 22, 2010

How can I get a list of all active Session IDs on a Web Server?

Using ASP.NET (C# or VB), or even Windows Forms, how can I obtain a list of ALL of the current Session IDs on the server (not just the current SessionId found by Session.SessionID.





Cheers





Ian

How can I get a list of all active Session IDs on a Web Server?
Actually, api to obtain all session id's is deprecated now.





Major reason is Secuirty. Its not safe enough to allow access to all sessions as they may contain sensitive infromation. Also giving access to all session would make possible to terminate session of other user without notice.





How ever you could do work around to get all current active sessions.





1. On every session creation save its reference in database.


2. On every session destroy delete its reference from database


3. Retrive at any point of time references present in database to get access to session objects.





Database would help in case of cluster env. otherwise you could use any datastructure on serverside to store references against user id.


No comments:

Post a Comment