CSS file only loads in IE when fetched via an ASP.NET MVC Controler + Action -


I am serving a site's CSS content through an ASP.NET MVC controller + action. CSS appears to be correctly distributed under "File" wire, but IE will ignore other browsers (Firefox, Opera, Chrome) CSS file and present the page without style. IE8 works perfectly.

This is a mandatory code that I am using to return the CSS via the controller and verb:

  public zero css (string version) {string CssFile = Server.MapPath ("/ site.css"); String cssContents = System.IO.File.ReadAllText (cssFile); Response.Write (cssContents); }  

Note that the version can be any string. I have tried with stars such as "myversion.css", "1.css", "1234", "arbitrary" etc.

All the work in IE8 but not any ideas in any other browser?

You must send the appropriate content-type: text / CSS header.

Firefox will otherwise ignore the style sheet, and its error console will produce a warning in the console. Probably hard for other Gecko / Webkit based browsers


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -