Tag Archives: Http Compression

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.