locked
Accessing a collection of Session IDs RRS feed

  • Question

  • I am not sure if I am in the correct place to post this, but my primary question is: Does .NET 4.5 provide a class or collection that allows you to access all of the session IDs that are currently active for a specific web application?

    To Be specific, I am working with a development project in VS 2013 for Web coded in Visual Basic which is a web application that can allow both anonymous and authenticated user to access certain areas of the application and post comments or questions. To keep certain session specific items separate for each user the application uses individual session subdirectories created on the fly in a 'temp' directory to store some images and other session specific files. The session temp directory is re-created if it does not exist when a new page is loaded, so I have contemplated adding code at some point that will wipe out all the user session temp directories. However, I would rather not put a garbage collection and cleanup routine in with the code that is run during every page load since it could delay loading pages depending on the number of users online.

    My idea is to maybe store each session id in the database when a new session is started and set a timer so every so many minutes a routine could be run that retrieves the session ids from the database and then compares them against current live session IDs on the server and then only remove those session temp directories that are no longer live sessions. However I have been unable to discover if there is a way to retrieve a collection of live session IDs from the server.

    Is this possible at all?

    Thanks,

    David


    • Edited by rdaviddd Friday, November 29, 2013 12:53 PM
    Friday, November 29, 2013 12:52 PM

Answers

  • Hi David,

    I pick up an article helps you list all the active session keys using a simple logic. Please refer to the following link. http://www.codeproject.com/Articles/36846/Retrieve-All-Active-Sessions-Data.

    By the way, this thread is specific to ASP. NET forum. This form is to discuss problems about CLR development. Please post thread on that forum for more effective response. http://forums.asp.net/.

    Thank you for your understanding.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, December 2, 2013 1:57 AM

All replies

  • Hi David,

    I pick up an article helps you list all the active session keys using a simple logic. Please refer to the following link. http://www.codeproject.com/Articles/36846/Retrieve-All-Active-Sessions-Data.

    By the way, this thread is specific to ASP. NET forum. This form is to discuss problems about CLR development. Please post thread on that forum for more effective response. http://forums.asp.net/.

    Thank you for your understanding.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, December 2, 2013 1:57 AM
  • Thanks a lot!! It worked like a charm ... now I have to work out how to deal with the session timeout factor ... when a session times out the code in the session_end  procedure produces an error if not trapped by a Try clause because httpcontext.current is 'Nothing' so httpcontext.current.sessionID is also 'Nothing'.I've been reading some articles on a "heartbeat" service that may help if I can figure out how to translate the PHP code the examples are written in to VB.NET for a service class.

    On a more personal note, I've been at this for over 40 years now and worked for a major telecom for 20 of those years where I was constantly being educated on the latest trends.  Now that I am "semi-retired" I have found that I have to constantly update my learning experience and educate myself to keep up with the current developments. In the process of updating my learning I have discovered that Microsoft's Channel 9 is a great help and I have gone through a number of the online video tutorials there and gleaned a lot of new information. I have also found that Visual Studio for Web is a great tool to work with when engaged in a web development project because Microsoft provides a lot of excellent information on the latest processes and development trends through Visual Studio's online connections!

    Thanks Again!
    David

    Wednesday, December 11, 2013 5:14 PM
  • Hi David,

    Please post new thread on ASP.NET forum for effective response.

    Thank you.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, December 12, 2013 1:45 AM