I am using Microsoft Visual Studio 2010 Professional and developing an asp.net / C# app. While in debug mode I can see the local variables under the "Locals" tab, and there is also something called "this" which expands into multiple tree structures. However, I am unable to find my Session variables name / value pair anywhere.
A friend suggested I use the "Immediate Window" tab and type the name of my Session variable (ie.,Session["SomeValue"] and press enter. This does give me the value of the Session variable. This is simple enough for a single session variable but when dealing with multiple variables it becomes a bit cumbersome.
Is there anyway that I can just browse to a section that stores the key / value pair for all my session variables, like I can for the local variables?
There might be a more elegant way, but if I recall you can dump out Session name/value pairs when tracing is enabled.
~/Trace.axd
In web.config
<configuration>
<system.web>
<trace enabled="true" requestLimit="40" pageOutput="true|false" />
</system.web>
</configuration>
http://msdn.microsoft.com/en-us/library/bb386420.aspx
Of course, this is only useful when there is a meaningful string representation of the object.
You could also look at writing a custom visualizer (I believe that's the correct term) that lets you inspect a type using your own custom functionality. I've seen this done for inspecting dynamic methods and it is quite useful, though I imagine it would be some effort to write one.
Maybe you can try using Watch Windows. Type
httpContext.Session["your session variable name"]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With