Resource interpreted as Stylesheet but transferred with MIME type text/html in ASP.NET IIS

sansknwoledge picture sansknwoledge · May 22, 2011 · Viewed 38.9k times · Source

i am having a login page when executed the page is stripped out of css.

I found out this message from from chrome debugger. I am using asp.net 2008.

Any ideas?

<head id="Head1" runat="server"> 
<title>CalibPro</title> 
<link href="css/Login.css" rel="stylesheet" type="text/css" /> 
<link href="css/Common.css" rel="stylesheet" type="text/css" /> 
</head>

edited as per @robx advice.

Answer

Variant picture Variant · May 23, 2011

Seems to me like the problem is in your IIS configuration. it might be configured to deliver .css files with text/html MIME type.

Try going to the MIME types configuration on the web server and see if you can spot anything there.

The correct MIME type for .css files is text/css.

You can also have a look on the HTTP header parameters with some HTTP sniffer such as fiddler.

Updating: The accepted answer should be the one pointed by @brett-pennings! Just providing static contents, the error vanished automatically.