In my ASP.NET MVC application I'm adding CSS and JavaScript files in the following way:
@Script.AddCss("~/Content/css/style2.css", siteWide: true)
@Script.AddCss("~/Content/css/tipsy.css", siteWide: true)
@Script.AddJavaScript(localPath: "~/Content/js/modernizr-2.5.3.js", siteWide: true)
@Script.AddJavaScript(localPath: "~/Content/js/jquery/jquery.datatables.js", siteWide: true)
And the output looks like the following:
@Script.OutputCss()
And almost the same for JavaScript:
@Script.OutputJavaScript()
Then the template engine combines all the files into AXD files and puts into the source of the page preserving the content-type.
This works fine in all browser but not in IE9. Sometimes the stylesheets are not being loaded and the following error message appears in the console:
SEC7113: CSS was ignored due to mime type mismatch
scripts.axd?type=Stylesheet&hash=74A0F67DE9D74AFCDAE1AA539EA11099
Besides of that, when you look into the Network tab, the AXD files are being loaded twice - 2 AXD files for the CSS and 2 AXD files for JavaScript. One of each file weights 0 bytes. This happens not always but only sometimes, too often though.
Could anybody help me with an advise on where the problem can be?
Thank you beforehand.