After an interesting discussion with Cristian Prieto (ASP.NET MVP) he pointed me in the right direction of a problem I was having.
The issue was with a web application I recently published to IIS. A new page I added was throwing an exception but instead of showing the error as I would expect, it was throwing a lot of garbage:
Now, the problem was that I didn’t have a way to find what the real problem was until he said that the output was probably being compressed, so after following his advice I checked with Firebug and the results were:
If you see the header Content-Encoding the value is gzip. That was a clear indicator of the output being compressed.
I checked the IIS7 settings and compression was not enabled, so I checked the Global.asax file and this is what I found:
After a couple of small refactorings thanks to ReSharper:
I was now able to disable output compression and see what the issue was. After solving the problem I enabled it again and things work as expected.
Checkout Cristian’s blog post about output compression (in Spanish).