views:

356

answers:

1

I use IIS web server 7.5 on Windows 7 for hosting my project. I try to create Javascript & CSS handler that can optimize and compress both Javascript & Css file size. But I found some problem. Please look at the following request & response of Test.css file which I found at Firebug on Firefox 3.0.11 browser.

Response Headers

Cache-Control : private
Content-Type : text/html
Content-Encoding : gzip
Server : Microsoft-IIS/7.5
X-AspNet-Version : 2.0.50727
X-Powered-By : ASP.NET
Date : Tue, 30 Jun 2009 10:46:15 GMT
Content-Length : 197

Request Headers

Host : localhost
User-Agent : Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11 (.NET CLR
 4.0.20506)
Accept : text/css,*/*;q=0.1
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 : 300
Connection : keep-alive
If-Modified-Since : Tue, 30 Jun 2009 10:41:00 GMT
If-None-Match : "1C9F96F41F48600"
Cache-Control : max-age=0

Moreover, I opened response tab of test.css file and I found that CSS file is loaded successfully. I try to open the same page in other browser like Chrome 3, Safari 4.0, Opera 10.0. But all browser can't display a correct web page except IE 8. Why?

body{margin:0;padding:0;background:#f7f7f7 url(Photoes/bg.jpg) no-repeat center top;}

PS. I try to disable compressor and all browser can display correctly.

+8  A: 

Your response header is incorret:

Content-Type : text/html

Should be

Content-Type : text/css
Greg
Still odd it only breaks with compression enabled though. This is probably the cause though.
Matthew Scharley
Thanks. I forget it. It's default content type.
Soul_Master