Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access other sessions

Status
Not open for further replies.

jcontesse

IS-IT--Management
Jul 21, 2003
10
US
Is there any way I can access other sessions on the same server (with administrator privileges?) so I can see the session variables created by the different users?

I'd like to have an ASPX page to list all connected users and have functions like ending all sessions or just selected ones.

Thanks in advanced!
 
Simple answer is No, sessions are managed per application
you can read all sessions on the web application though



Note:Copying and Pasting is NoT Creativity.
What would you attempt to accomplish if you knew you would not fail?
 
Thanks for the answer.

So if I understand correctly I could have a class in my global.asax.vb or a method in the Global class that can return the information I need from each existing session.

Am I correct? If so, how can I do that?

 
This will display all active sessions in a web app
add label to your webform and call it lblSession
you can add the following code in page load or use it as a function to return all session objects
Code:
Dim keys As 
System.Collections.Specialized.NameObjectCollectionBase.KeysCollection = 
Session.Keys
    Dim key As String
    Dim sSessions As String

    For Each key In keys
      sSessions &= key.ToString & " - " & Session(key).ToString & "<br>"
    Next key

    If sSessions.Length = 0 Then
      lblSession.Text = "No Active Sessions"
    Else
      lblSession.Text = sSessions
    End If

Good luck


Note:Copying and Pasting is NoT Creativity.
What would you attempt to accomplish if you knew you would not fail?
 
however... I believe that if you use application variables to store arrays with the values from the user sessions that you are interested in, you could 'see' what they have set and also you could 'end it' by let's say setting a value of false in the registered_session array found at application level. on each request to the server, your application has to verify if the value assigned to it is true or false. if it's true, return the request, if it's false, simply deny the request and sign the user out (or delete the cookie)

--------------------------
"two wrongs don't make a right, but three lefts do" - the unknown sage
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top