A couple of years ago I was dealing with an ASP.NET application with session state issues. This happens, if you can believe it. I was flummoxed by the problem and the routine checks and configuration options didn’t seem to fix the problem (although there was one little thing that was causing me problems and I didn’t catch it before I went down the path I am about to write about). I decided I needed to find a way to peer into ASP.NET session state. Given that the web application was storing state in Microsoft SQL Server, the challenge was to figure out how to make sense of the state information stored in the database. For background information, check out this tag from my old blog.
If you have read some of those older posts, you might note that I wrote a session monitoring application a while back. That code is somewhere in the mists of time and I wouldn’t use it as it was anyway because it had some issues, so I decided to take another swag at it. Also, Philippe sent me an email asking for the tool, so I thought I would oblige and deliver it to everyone.
Here it is on MSDN Code Gallery.
I had to read my own blog posts again and figure out how this works and it is a little rough, so consider this a starter project for somebody with more time who might improve it. The basic requirements are as follows:
The key feature of the user interface shown above are:
I will leave it to you to peruse the source code and read this deep dive to understand how this works.
I created a very simple web application to demonstrate the session monitor:
Let’s start with a screenshot of the session monitor as it monitors, with no sessions currently in play:
In the test application, I add primitive (which is also the name of the value) value “14” and here is the result:
In the test application, I add a value to the list and here is the result:
In the test application, I update the primitive value to 23 and here is the result:
You can see that the session monitor picked up the new value and displayed it below the original value.
For non-primitive values or strings, you can click the View link and see basic properties:
That’s it folks! Hope this is useful to somebody :-)