Can I loop through all active session objects?

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
 
P

Patrice

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

Patrice
 
C

Christina N

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

Christina
 
C

Christina N

Do you have a suggestion for a structure like that, using vb.net?

Thanks,
Christina
 
P

Patrice

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

--
 
K

Kevin Spencer

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
 
P

Patrice

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

--
 
G

Girish Bharadwaj

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,824
Latest member
Nater888

Latest Threads

Top