0

I am running a website using IIS6 and i wrote a simple generic handler which return smaller images when it receive image url as query string. My problem is that the server is applying gzip to some file types such as .aspx and .ashx.
And that made my response image from the handler appear with lower quality because they are compressed.

How can i disable gzip for just this handler file, i hope for a solution without editing the IIS.

Is that possible?

Amr Elgarhy
  • 66,568
  • 69
  • 184
  • 301

2 Answers2

1

This SO answer seems to be almost exactly the same as your scenario.

In the answer is this link discussing how to do a folder based on/off compression scenario.

There is also this link that discusses this near the bottom of the article.

You should be able to do it by editing the metabase yourself or via adutils.vbs.

Community
  • 1
  • 1
Kevin LaBranche
  • 20,908
  • 5
  • 52
  • 76
0

This worked for me - in the ProcessRequest method:

context.Request.Headers.Remove("Accept-Encoding")

I assume that this makes IIS think that the client does not support GZip (or other compression methods) and therefore sends the response uncompressed.

Yes - it is a hack (generally you should not mess with the request headers) but it is by far the simplest solution I have seen.

I personally needed this because a simple 5 character plain text response to an Ajax call ended up being 124 bytes long after GZip "compression".

This answers the title of this question. However for your scenario with images - it really shouldn't make any difference as GZip is lossless (uncompressed data = original).