View logged users and the session variables
Hi !!!
I'd like to get, from my application server, a list of the logged users with these details: application they are logged in and state of Session variables.
For instance:
User: John
Application: TimeTables
Session variables: id_user=12 | blnShowAll=false | ...
User: Martin
Application: SalesTracking
Session variables: id_customer=0 | bestcolor=green | ...
How could I do this ???
Thanks in advance for ideas !!!
Re: View logged users and the session variables
That is to say, if there's a possibility to watch ALL the Session objects of all the users...
Re: View logged users and the session variables
Have you thought about creating a shared class?
maybe something like:
Code:
Namespace your.namespace
Private Shared Users(0) as Long
Public Class Users
Sub Add(ByVal UserID as Integer)
Dim iUBound as Integer = Users.GetUpperBound
ReDim Preserve Users(iUBound + 1)
Users(iUBound + 1) = UserID
End Sub
End Class
End Namespace
So in your page, you would need to include this namespace.. Then call it like this:
PHP Code:
<%@ Imports Namespace name="your.namespace">
<%your.namespace.Users.Add(3) %>
<html>
<body> etc
Well something like that... havent tested it or anything, and its friday night.... beer time :wave:
Re: View logged users and the session variables
I'm sorry, I can't see how that code helps me to watch the Session variables of the users...
I can watch the Session object of my application and all the values that it contains:
Code:
for (int i = 0; i < Session.Keys.Count; i++)
Response.Write (Session.Keys[i].ToString ());
I need something like this but for every Session State in the Web Server...
Re: View logged users and the session variables
Are your session variables cookie-based? If so, you can't look at them all at once, as they are stored on different client machines.. If you were to change to sql-server maintained sessions, it would be a case of checking the database table. But you loose your Session_Ended event of global.asax
Re: View logged users and the session variables
I keep session variables in mode="StateServer"
Re: View logged users and the session variables
What type of StateServer / webfarm software are you running?
Re: View logged users and the session variables
I'm runing a ASP.Net webform...
I now session avriables can be stored InProc, StateServer (a server service) or SqlServer...
I found that, enabling tracing, in http://localhost/MyApp/trace.axd there's a detail of the requests... Maybe it's possible to programatically filter this data and get only the session variables?
Thanks for ideas !!!
Re: View logged users and the session variables
I too have been looking for a solution to this problem for a LONG time already. seems that this cannot be done at all
Re: View logged users and the session variables
In general it is made difficult for security reasons. While monitoring all of the sessions may be useful for debugging or other diagnostic purposes, it rarely has a place in a production system.
That being said, the easiest way to do this is to structure your app so that the session information is shadowed to another location. But you need to be careful as this will create an additional reference and may hinder garbage collection.
If there are specific peices of information that you are conserned about, then storing (or logging) them independantly is probably a better alternative.