CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10
  1. #1
    Join Date
    Aug 2003
    Location
    Buenos Aires, Argentina
    Posts
    513

    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 !!!

  2. #2
    Join Date
    Aug 2003
    Location
    Buenos Aires, Argentina
    Posts
    513

    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...

  3. #3
    Join Date
    Dec 2003
    Location
    Northern Ireland
    Posts
    1,362

    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>
    <
    bodyetc 
    Well something like that... havent tested it or anything, and its friday night.... beer time
    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook


    0100 1101 0110 1001 0110 0011 0110 1000 0110 0001 0110 0101 0110 1100 0010 0000 0100 0101 0110 1100 0110 1100 0110 0101 0111 0010

  4. #4
    Join Date
    Aug 2003
    Location
    Buenos Aires, Argentina
    Posts
    513

    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...

  5. #5
    Join Date
    Dec 2003
    Location
    Northern Ireland
    Posts
    1,362

    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
    Last edited by HairyMonkeyMan; February 27th, 2006 at 10:37 AM.
    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook


    0100 1101 0110 1001 0110 0011 0110 1000 0110 0001 0110 0101 0110 1100 0010 0000 0100 0101 0110 1100 0110 1100 0110 0101 0111 0010

  6. #6
    Join Date
    Aug 2003
    Location
    Buenos Aires, Argentina
    Posts
    513

    Re: View logged users and the session variables

    I keep session variables in mode="StateServer"

  7. #7
    Join Date
    Dec 2003
    Location
    Northern Ireland
    Posts
    1,362

    Re: View logged users and the session variables

    What type of StateServer / webfarm software are you running?
    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook


    0100 1101 0110 1001 0110 0011 0110 1000 0110 0001 0110 0101 0110 1100 0010 0000 0100 0101 0110 1100 0110 1100 0110 0101 0111 0010

  8. #8
    Join Date
    Aug 2003
    Location
    Buenos Aires, Argentina
    Posts
    513

    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 !!!

  9. #9
    Join Date
    Mar 2005
    Location
    マレーシア
    Posts
    155

    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
    Ai nò mai speling sùks, bùt ai du it mainfuli
    http://www.geocities.jp/juuhassai/i_rouseiji.html

  10. #10
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125

    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.
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured