How to view all session variables in debug mode?

I use Microsoft Visual Studio 2010 Professional and am developing an asp.net/C# application. In debug mode, I see local variables on the tab "Locals", and there is also something called "this", which expands into several tree structures. However, I cannot find the name / value pair of the Session variables anywhere.

A friend suggested I use the Immediate Window tab and enter the name of my session variable (ie Session ["SomeValue"] and press enter. This gives me the value of the Session variable. It’s enough for one session variable, but when working with multiple variables it getting a little bulky.

Is there anyway that I can just go to the section that stores the key / value pair for all my session variables, for example, can I use local variables?

+6
source share
2 answers

Maybe a more elegant way, but if I remember, you can reset the session / value name pairs when tracing is turned on.

  • enable tracing
  • execute page
  • tracing information is added either below or is available in ~/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 can also look at creating a custom visualizer (I think the right term), which allows you to type check using your own functions. I saw this for testing dynamic methods, and it is very useful, although I believe that there would be several attempts to write it.

+3
source

Perhaps you can try using Watch Windows. A type

 httpContext.Session["your session variable name"] 
+3
source

Source: https://habr.com/ru/post/922941/


All Articles