开发者

ASP.NET MVC on IIS6 rendering issue

I have a small asp.net mvc app running on WIN2k3 and IIS6.

I'm using a wildcard mapping under the application settings in IIS as described in this article http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx . The application works fine under my local asp.net development server. When I publish from VS2008 out to the production server above the styles are looking partially rendered. For instance. I have an overflow: hidden; set on the body {} and the browser is showing a scrollbar horizontally and vertically. Also, the z-index on all my layers are incorrect. Any ideas would be much appreciated.

Here's a sample of my document head.

<head>
    <meta http-equiv="Content-Language" content="en-us" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>page title | <%= ViewData["PageTitle"]%></title>
    <link rel="shortcut icon" href="/content/images/misc/favicon.ico" type="image/x-icon" />               
    <%= Html.MooFrameworkConfig("Default")%>
    <%= Html.JavaScript("/scripts/framework.js")%>
</head>

framework.js includes the CSS like so:

this.loadCSS("layout.css", "screen");

here is the loadCSS method:

framework.loadCSS = function(fileName,mediaType) {              
    var headID = document.getElementsByTagName("head")[0];
    var cssNode = document.createElement('link');
    cssNode.type = 'text/css';
    cssNode.rel = 'stylesheet';
    cssNode.href = '/content/skins/' + skinBase + '/css/' + fileName;
    cssNode.media = mediaType;
    headID.appendChild(cssNode);
}
开发者_StackOverflow


Just as a test, does linking to the CSS file in the HTML (as opposed to loading it with JS) fix the problem?


It is unlikely to be a problem with the web server, per say. Is it possible that the stylesheet you're using isn't being served by the webserver? Maybe the URL to it is slightly different? Check by navigating manually to the stylesheet or by checking that it is being loaded in firebug.


Did you include the CSS fix from the article?

HttpContext.Current.RewritePath(Request.ApplicationPath, false);

I think you may need to post snippets from your website where you include the CSS file and where you simulate the article so that you can get better tips.


You can use Fiddler tool to check if all the files are loaded correctly, I mean no HTTP 403 or 500 or some other status codes for all the files (.css,.js) included in your page. There maybe some server settings preventing displaying your page correctly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜