Serverside css not working in FireFox and Chrome

2.2k views Asked by At

I am using asp.net4 and have CSS presented like this in the head tag.

<link href="/ReadCss.aspx?css=<%
=Server.UrlEncode("~/Interface.css") %>" rel="stylesheet" type="text/css" />

This is so I can process a few variables into the sheet before giving it to the browser.

This works in IE8, it does not work in Firefox 3.6 or Chrome 9.

In FireFox and Chrome, it is as if the stylesheet is not applied to the page. All styles and formatting are missing.

Checking the IIS log and I see the page is sent successfully to those browsers. I can even directly navigate to the Read.aspx address and see the css.

How can i get these to work in those browser?

thanks

Additional This is what the render looks like.

<link href="/ReadCss.aspx?css=%7e%2fcss%2fInterface.css" rel="stylesheet" type="text/css" />
1

There are 1 answers

3
wsanville On BEST ANSWER

Make sure your page sets a Content-type of text/css. If your page is serving as something else like text/plain, Firefox will likely ignore it. Try setting Request.ContentType = "text/css"in your codebehind.