Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Caching / September 2003

Tip: Looking for answers? Try searching our database.

Is there any way to view all session data?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Walt - 25 Sep 2003 18:52 GMT
The subject says it all.  Is there any way to determine
how many clients are attached to a web application and
what session data is in use for each client?
"Mike Moore [MSFT]" - 26 Sep 2003 00:25 GMT
Hi Walt,

This isn't too hard to do. What is hard is using it safely once you've got
it setup. With this, all users have access to all other users' data. Also,
updates to the data could occur at any time, including multiple
simultaneous access to the same data. With one session per user, this isn't
much of a problem. With everyone accessing each other's data, it could
cause problems.

Here is one way to do this. This method puts a collection object into the
application object and adds each session to the collection.

  Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
     Dim colAllSessions As New Collection
     Application.Add("AllSessions", colAllSessions)
     Dim colOldSessions As New Collection
     Application.Add("OldSessions", colOldSessions)
  End Sub

  Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
     CType(Application("AllSessions"), Collection).Add(Session,
Session.SessionID)
     Session("test") = "hello " & Session.SessionID
  End Sub

  Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
     CType(Application("OldSessions"), Collection).Add(Session.SessionID,
Session.SessionID)
     CType(Application("AllSessions"),
Collection).Remove(Session.SessionID)
  End Sub

---
This can be tested with a test page with this code-behind:
  Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
     Response.Write(Session.SessionID)
     Response.Write("<hr>")
     Dim i As Long
     For i = 1 To CType(Application("AllSessions"), Collection).Count
        Response.Write(CType(CType(Application("AllSessions"),
Collection).Item(i), SessionState.HttpSessionState).SessionID & "<br>")
     Next
     Response.Write("<hr>")
     For i = 1 To CType(Application("OldSessions"), Collection).Count
        Response.Write(CType(Application("OldSessions"),
Collection).Item(i) & "<br>")
     Next
     Response.Write("<hr>")
  End Sub

---
Does this answer your question?

Thank you, Mike
Microsoft, ASP.NET Support Professional

Microsoft  highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three straightforward
steps listed to improve your computer?s security.

This posting is provided "AS IS", with no warranties, and confers no rights.

--------------------
> Content-Class: urn:content-classes:message
> From: "Walt" <lord@brodart.com>
[quoted text clipped - 13 lines]
> Path: cpmsftngxa06.phx.gbl
> Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.aspnet.caching:1468
> NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
> X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.caching
>
> The subject says it all.  Is there any way to determine
> how many clients are attached to a web application and
> what session data is in use for each client?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.