Peter Mounce
Peter Mounce

Reputation: 4225

Is there a Visual Studio debugger visualizer for the ASP.NET Session?

If so; where can I get it?

Upvotes: 8

Views: 392

Answers (2)

Thomas
Thomas

Reputation: 2197

Have you tried this one from Codeproject? After correcting the Reference to Microsoft.VisualStudio.DebuggerVisualizers from version 9.0 to 10.0 it worked in vs2010.

Installation folder is:

C:\Program files\Microsoft Visual Studio 10.0\Common7\Packages\Debugger\Visualizers

Upvotes: 2

Bart van der Vliet
Bart van der Vliet

Reputation: 151

Peter, it is better that you centralize the session access.

public class SessionStateBag
{
    private static string SessionPropertyXKey = "SessionPropertyX";
    public static int SessionPropertyX
    {
        get { return Session[SessionPropertyXKey]; }
        set { Session[SessionPropertyXKey] = value; }
    }

    private static string SessionPropertyYKey = "SessionPropertyY";
    public static string SessionPropertyY
    {
        get { return Session[SessionPropertyYKey]; }
        set { Session[SessionPropertyYKey] = value; }
    }

    // etc. Try to guess the type of the session property. If you cannot guess it; use object.
}

In the rest of the code, replace Session["xxx"] with one of the properties of SessionStateBag above.

This might take you a day or two, but you will have all session access on one place and you have the ability to have insight in the maze the Session object sometimes creates.

Upvotes: 2

Related Questions