How do I disable chunked transfer-encoding when using compressed dynamic content?

Noah Jacobson picture Noah Jacobson · May 21, 2009 · Viewed 7.4k times · Source

I want to disable chunked transfer encoding on my web server, in order to avoid this bug: http://support.microsoft.com/kb/871205 . Unfortunately, I need to support IE6 on Win2k, so they cannot install the patch.

I found instructions to set AspEnableChunkedEncoding to FALSE, but this does not seem to solve my problem. I believe this is because we also use gzip compression, which, according to this article (http://www.eggheadcafe.com/conversation.aspx?messageid=31045986&threadid=31045970) requires chunked encoding in order to compress dynamic content. Thus, all of the dynamically compressed content is transferred 'chunked', because it's compressed by the gzip filter, not ASP.NET.

I know that IIS can serve this content unchunked, because I've tried using http 1.0 in the request (which does not support transfer-encoding: chunked), and the response arrives correctly and compressed.

How do I disable chunked encoding when using a ScriptManager, which necessitates dynamic compression of the resultant ".axd" files?

Answer

lambacck picture lambacck · Dec 3, 2010

Since you can't change the behaviour of either the GZip compression in IIS or get your client to upgrade to a new OS, why not conditionally turn off GZip compression for specific user agent strings.

On Apache you could use mod rewrite to do this (see here) with some lines like:

RewriteEngine on

RewriteCond %{HTTP:User-Agent} MSIE\ [56]
RewriteCond %{HTTP:User-Agent} !SV1
RewriteCond %{REQUEST_URI} \.(css|js)$
RewriteHeader Accept-Encoding: .* $1

This server fault thread indicates that you can use ISAPI Rewrite to use the same directives and get the same result. It looks like these directives would be supported by the free "Lite" version too, so you won't have to buy any licenses.