See your ASP.NET app's server interaction thanks to Glimpse

Glimpse lets you see what’s happening on the server for your ASP.NET application, all within the browser and with no changes to the application.

What is going on?

We’ve all been in this situation: The code looks right and the page is displaying correctly, but execution isn’t matching expectations. You dig into the code and use the Visual Studio debugger among other tools.

The ability to see what’s happening on the server is valuable in this type of situation, and that’s where Glimpse enters. You add Glimpse to your Visual Studio application, and it opens a window in the web server. Debugging HTTP requests is possible via Fiddler or by using browser tools, but Glimpse offers more features and is tightly integrated with Visual Studio.

Getting and using Glimpse

Glimpse is available as a Visual Studio Extension via NuGet.Glimpse requires at least ASP.NET using at least .NET 3.5, IIS 6.0 or above, and IIS Express or Visual Studio’s Web Development Server.

The Glimpse home page prominently lists the three basic steps for using it within an ASP.NET application. The first step is adding it to your Visual Studio solution by way of the NuGet package manager. Right-click the solution and choose Manage NuGet Packages. Figure A shows the available Glimpse packages found via the search box (upper right corner).

Figure A

Glimpse_FigA_092513.jpg
Adding Glimpse to a Visual Studio ASP.NET project via NuGet. (See an enlarged view of the image.)

The packages presented in Figure A are confusing, as there are multiple available; I figured out which to use for my project via trial and error. I could have saved time by reading the Glimpse online documentation, which provides all the details on what is necessary. Basically, the difference in what is used depends on whether the project uses WebForms or a version of MVC. I chose Glimpse ASP.NET for my test application. The Glimpse Core package will be installed with the other packages, so there’s no need to install it separately.

Figure B shows what is added to an application once Glimpse is installed. The NuGet installation path is the most straightforward, though Glimpse can be installed manually or via the command line as well. Other configuration options must be set up to use it; the documentation provides all of the necessary information.

Figure B

Glimpse_FigB_092513.jpg
Glimpse resources added to an ASP.NET application. (See an enlarged view of the image.)

What’s happening on the server?

Once Glimpse is installed, its interface is accessible via glimpse.axd on the web application’s URL. Figure C shows the page loaded on my Visual Studio local development server. The two links on the right of the page allow you to easily turn Glimpse on or off.

Figure C

Glimpse_FigC_092513.jpg
Glimpse page displayed when it is loaded on your server. (See an enlarged view of the image.)

Once Glimpse is enabled, its toolbar will appear on the bottom right of the browser window when the application is loaded. Figure D shows it displayed on my simple application — the left portion of the Glimpse toolbar has been selected, which is why it appears larger. The lowercase g at the far right of the toolbar (lower right of Figure D) opens and closes the full Glimpse interface when clicked. Figure E shows it opened.

Figure D

Glimpse_FigD_092513.jpg
The Glimpse toolbar appears in the browser once enabled. (See an enlarged view of the image.)

Figure E

Glimpse_FigE_092513.jpg
The Glimpse toolbar opened on a basic ASP.NET application. (See an enlarged view of the image.)

The Glimpse interface resembles many of the browser developer tools, such as Chrome’s Developer Tools. Glimpse provides the following eight basic areas.

  • The Configuration tab provides information on the web server configuration (line connection strings and httpModules).
  • The Environment tab provides details on the server environment.
  • The Request tab provides details of the most recent HTTP request.
  • The Routes tab routes setup on the server.
  • The Server tab provides a snapshot of HTTP variables.
  • The Session tab delivers information on the current session (if applicable).
  • The Timeline tab offers the timing of the start and end of the HTTP request.
  • The Trace tab presents trace information (if applicable).

Figure E shows the details of the Environment tab for my test environment, while Figure F provides information on my test server. Figure G shows the request history (link on top right of toolbar), as it gives you details on server requests. Other sections may be added depending on the tools being used. For example, a tab will show up to display details on SQL queries if you use the Entity Framework.

Figure F

Glimpse_FigF_092513.jpg
Server tab details for my test application. (See an enlarged view of the image.)

Figure G

Glimpse_FigG_092513.jpg
Glimpse allows you to easily view request history. (See an enlarged view of the image.)

A nice tool for peeking inside HTTP traffic

I’ve just started using Glimpse, but I’m already impressed with the information it provides with only a few clicks. While nobody likes to have application problems, I cannot wait for the next situation where I can rely on Glimpse to get a better idea of what’s happening on the server while a user is interacting with an application.

http://www.techrepublic.com/blog/software-engineer/see-your-aspnet-apps-server-interaction-thanks-to-glimpse/