none
How do I get all the Session objects currently stored in AppFabric cache?

    Question

  • Hello, I am using the AppFabric cache as the Session State provider for my ASP.NET application, and it is working perfectly.  However, does anyone know how I can query the cache to get all of the current Session objects?  I want to create an admin page that displays useful statistics about all users who are currently logged into the site (and therefore have a Session object).

     

    Thanks,

    Matt

    Tuesday, October 18, 2011 7:04 PM

Answers

  • Hi,

    You won’t be able to get that without some kinds of hacking (using reflection). ASP.NET doesn’t allow you to list session data for all users, and AppFabric doesn’t allow you to enumerate all cached items. You can try the code on http://weblogs.asp.net/imranbaloch/archive/2010/04/05/reading-all-users-session.aspx, which uses reflection to obtain all session items. It talks about in-proc session, but it should also work for session stored in AppFabric cache. Be extremely careful not to leak one client’s session data to another.

     

    Best Regards,

    Ming Xu.


    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com.
    Microsoft One Code Framework
    • Marked as answer by OceanMorning Thursday, October 20, 2011 8:22 PM
    Wednesday, October 19, 2011 6:20 AM
    Moderator