0
votes

Using Internet Explorer 8, Firefox 3.6, Chrome 8 and IIS 7.5 on a Win7 x64 box.

I'm serving up a file using an IHttpHandler (.NET 4).

According to Fiddler, my IIS request from IE8 says it accepts gzip, but it isn't returned:
(note that loc.portal.com is actually 127.0.0.1)

GET http://loc.portal.com/AdminCenter/FileHandler.ashx?ID=115 HTTP/1.1
Accept: application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/pjpeg, application/x-ms-xbap, application/x-shockwave-flash, */*
Accept-Language: en-US
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; MDDR; .NET4.0C; .NET4.0E; MS-RTC LM 8; InfoPath.3)
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
Host: loc.portal.com
Cookie: LoginName=; ASP.NET_SessionId=d5qiw5nubkjd2r00gnebg3ar; .ASPXAUTH=BAEA blah blah

Header returned from IIS to IE:

HTTP/1.1 200 OK
Cache-Control: private
Transfer-Encoding: chunked
Content-Type: application/msword
Server: Microsoft-IIS/7.5
Content-Disposition: attachment; filename="Roll Worksheet.doc"
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Mon, 24 Jan 2011 20:53:34 GMT

Notice it's not gzipped.

With Firefox, however, the request looks like this:

GET http://loc.portal.com/AdminCenter/FileHandler.ashx?ID=115 HTTP/1.1
Host: loc.portal.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: http://loc.portal.com/sb.cn
Cookie: ASP.NET_SessionId=hw104pctkzrdtciwg4ihriqx; .ASPXAUTH=4FBB blah blah

The response, correctly, says it's returning gzip:

HTTP/1.1 200 OK
Cache-Control: private
Transfer-Encoding: chunked
Content-Type: application/msword
Content-Encoding: gzip
Server: Microsoft-IIS/7.5
Content-Disposition: attachment; filename="Roll Worksheet.doc"
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Mon, 24 Jan 2011 20:55:07 GMT

Chrome looks similar to Firefox. It asks for gzip and gzip is returned. I can see by the content size displayed in Fiddler that the body is, in fact, gzipped for Chrome and Firefox but not IE.

I have "Enable dynamic content compression" (as well as static content compression) set in IIS. My IHttpHandler isn't doing anything special with compression and it's not running different code for different browsers. I searched the source for my project and I don't see any mention of "gzip" at all so I don't see how I could be accidentally mucking with it.

How can I figure out why IIS isn't sending gzipped data to IE?

1
Does it matter? IE users are used to slow loading pages, so an extra second make no difference. Oh, and this belongs on ServerFault. :)user142019
ServerFault... maybe. Seems like it could be an ASP.NET issue and thus a development problem not a server problem. As to "does it matter": probably not, to be honest it drives me crazy not understanding weird behavior. :-)mhenry1384
Yeah IE drives me crazy sometimes too… I'm not the only one, but I know that longer than today. Maybe the biography on my profile page will help. ;Duser142019
Yeah, there should be some way of semi-migration on SO. that a question appears on two different sites at the same time. In this case, on both StackOverflow and ServerFault. I'm too tired to file a feature-request right now. Well, maybe tomorrow. :)user142019
Perhaps you could try putting a static html file in your wwwroot somewhere, so you can isolate whether it is an ASP.NET issue, or an IIS issue.Jeremy Vanderburg

1 Answers

0
votes

When I make a request using IE, I see that context.Response.Filter == System.Web.HttpResponseStreamFilterSink. When I make a request using Firefox or Chrome, I see that context.Response.Filter == RadGZipStreamNet40. According to the IIS "Failed Request Tracing" logs*, the built-in IIS dynamic compression isn't firing at all. It's apparently Telerik that is deciding that calls from IE should not be compressed and calls from other browsers should be.

According to the docs:

RadCompression will automatically detect and compress requests that expect these content response types: application/x-www-form-urlencoded application/json application/xml application/atom+xml (source: http://www.telerik.com/help/aspnet-ajax/radcompression.html)

The other browsers are reporting they accept, among other things, "application/xml" so RadCompress gzips the response. IE is not reporting it accepts any of those things so it does not.