Can I loop through all active session objects?

  • Thread starter Thread starter Christina N
  • Start date Start date
C

Christina N

I want to output a list of all active SessionID's and their last time of
activity.
Can I loop through the active sessions and create a list like that?


I use ASP.Net (VB.Net)

Best regards,
Christina
 
No, by definition a session is private but you could have each session
recording its activity in a global structure...

Patrice
 
Is it private for the application? The application layer should be able to
access its active sessions. Or how about the server itself?

Christina
 
IMO no. The Web progamming model is to process a request and have all at
your disposal to process this request. It includes session data belonging to
this request but not session data that could be used in other request... IMO
the whole list is private to the module thant handles associating the
session state to the current request.

Patrice

--
 
Session is a Collection. There is one per client. So, what you need is
either a structure or class containing a Collection or array (to hold the
members of the client's Session Collection), as well as a SessionID (to
identify the client Session).

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living
 
If you have a page on which all pages are based you could : when this page
load, records the sessionid and the current server date/time in a
collection. The collection could be a HashTable.

You'll then be able to sort all sessionIDs and the last activity date for
this session from all sessions...

You may want also describe why or for what you need this information. For
example the number of sessions is a counter that is readily available as a
performance counter...

Patrice

--
 
I wonder if writing a HttpModule would be useful in this case. You can
handle the PreProcess Request events and at that point you can do what
Patrice is suggesting below.
 
Back
Top