Click to See Complete Forum and Search --> : View logged users and the session variables
vbUserName
February 24th, 2006, 11:40 AM
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 !!!
vbUserName
February 24th, 2006, 01:04 PM
That is to say, if there's a possibility to watch ALL the Session objects of all the users...
HairyMonkeyMan
February 24th, 2006, 03:20 PM
Have you thought about creating a shared class?
maybe something like:
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:
<%@ 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:
vbUserName
February 27th, 2006, 07:52 AM
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:
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...
HairyMonkeyMan
February 27th, 2006, 09:34 AM
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
vbUserName
February 27th, 2006, 09:43 AM
I keep session variables in mode="StateServer"
HairyMonkeyMan
February 27th, 2006, 10:09 AM
What type of StateServer / webfarm software are you running?
vbUserName
February 27th, 2006, 10:28 AM
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 !!!
hitai
December 16th, 2006, 08:44 AM
I too have been looking for a solution to this problem for a LONG time already. seems that this cannot be done at all
TheCPUWizard
December 16th, 2006, 09:04 AM
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.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.