tags:

views:

151

answers:

3

I'm looking to write a user and session tracking tool.

What I'm trying to do is create a page that lets me see which users are logged in and what session data is being used by that user.

Is this possible? Or do I need to write a custom session provider?

A: 

No, you can not access other sessions' data. Maybe you can log session variables and read with your tracking tool.

Canavar
+1  A: 

If you use SQL Server to store session data, it ~might~ be possible to dig into the database... but it wouldn't be easy.

If you really want to do this, you might want to create a custom class for Session and store that in the Application data. For example, you might want to associate an ASP.NET HttpContext.Current.Session.SessionId with a HybridDictionary that stores Key/Value pairs. You could then spy on the data at an application level.

Dead account
+1 for the suggestion in the 2nd paragraph
Mike Powell
A: 

You could use this method in global.asax, no?

void Session_Start(object sender, EventArgs e)
{
    // Insert session id into cache or DB or something
}


void Session_End(object sender, EventArgs e)
{
    // Remove session id from cache or DB or something
}
cerhart
Note that Session_End is only called with InProc session handling.
Zhaph - Ben Duguid
I'm hoping to write something more fine grained than that. I'd like to inspect each object in a users session.
ilivewithian
Couldn't you store the whole session object in the cache?
cerhart