Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

If so; where can I get it?

like image 925
Peter Mounce Avatar asked Apr 26 '10 09:04

Peter Mounce


2 Answers

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

like image 90
Thomas Avatar answered Nov 13 '22 20:11

Thomas


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.

like image 42
badabadabada Avatar answered Nov 13 '22 20:11

badabadabada