Tag Archives: configuration

Glimpse and HTTP Compression

Well its been a while since our last post, during this time we have been heads down and trying to get the next release out. This effort has been using up the majority of our time, but it will be worth the wait and is poised to be our best release yet. If you are interested in the blow-by-blow accounts feel free to subscribe to the Mailing List or track our Commits.

In this release we have been looking to close out the majority of our outstanding issues in GitHub. With this in mind we have gone through and closed out almost all our 80 issues. This has been no easy task and has forced us to look at problems we have been avoiding for a long time.

One of the biggest has been the conflict between Glimpse and sites that have HTTP Compression turned on. For more time than I care to admit, we have been avoiding this as we didn’t have a very good solution for the problem. But finally Nik came up with an innovative way to get around this issues.

As it turns out (and I know this is stating the obvious) you can alter the HTTP payload after it has been compressed. Unfortunately, with the way that Glimpse leveraged a HttpModule to alter response payloads and the way the ASP.NET pipeline works, we can’t guarantee that we would come before the compression would take place. Hence, if ever Glimpse ran after compression it would destroy the response – obviously something that people weren’t happy with.

Given this, we needed a way to ensure that the necessary script tags would be included in the payload before compression takes place. The answer was to create an Html helper (or like concept) that the developer would “manually” put into the sites master page. This helper would render out the required tags and signal the main system not to run its usual logic. Here is an example of how looks:

In MVC applications, simply add the following HTML helper call in your layout file right before the </body> tag:

@Html.GlimpseClient()

You will need to also add @using Glimpse.Mvc.Html to your view or in web.config.

In WebForms applications, you place the following server control before the </body> tag.

You will also need to register the Glimpse control at the top of your page or in web.config.

<%@ Register TagPrefix="glimpse" Namespace="Glimpse.AspNet.Controls" Assembly="Glimpse.AspNet" %>

We realize that this deviates from the usual “it just works” mantra, but unfortunately in this case when you are using Compression, it looks like this is the best solution.

To get this update, you can either wait for the v1 RC2 or checkout the Daily Builds. Let us know how you get on.

Blacklisting and Remove Plugins

In an effort to try and make some of the lesser known features of Glimpse some air time, we thought we would put together a few short posts on how to perform a coupe of tasks that might get you some quick wins.

First in the list is Blacklisting/Remove Plugins. Out of the box Glimpse provides several plugins. Depending on what version of Glimpse you go for (Glimpse
or Glimpse.MVC3) you will have a variety of tabs that serve different purposes.

We are still refining the list of what is useful and what people want to see, but if there is something you don’t want, removing it is quite straight forward. In this case you would simply add a “pluginBlacklist” element to your glimpse config and using the fully qualified name of the plugin, add items to the blacklist:

<glimpse>
      <pluginBlacklist>
            <add plugin="Glimpse.Mvc3.Plugin.MetaData" />
            <add plugin="Glimpse.Mvc3.Plugin.Binders" />
            <add plugin="Foo.Bar.GlimpsePlugins.CurrentUser" />
      </pluginBlacklist>
</glimpse>

*It should be noted that if you wanted to blacklist 3rd party plugins, this is more than possible using the same method, as demonstrated with the Foo.Bar.GlimpsePlugins.CurrentUser line above.

Other cases where you might want to blacklist plugins, is for different environments. Lets say, if in development you want all tabs, but in UAT, you want half of them removed and in PROD you only want tracing, Glimpse can support this. You could have several reasons to do this like reducing payload size, or for security concerns. All you would need to do is blacklist the plugins you don’t need in the config file for each environment.

If should be noted that, if you blacklist a plugin, not only do we not show that tab, but the plugin never gets wired into the life-cycle of the page. Blacklisted plugins add absolutely no overhead and are never instantiated.

Hope that helps and let us know what you think and if we can do anything more in this area.