views:

256

answers:

4

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);
}
A: 

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.

stimms
I can navigate to the css manually fine. I think it's definately a server issue. I published the site out to my production server running the same specs and it works fine so I think it's just something on my local development server. I wish I could narrow down the issue but it might just save me time to reinstall IIS and my web dev components.
ringerce
The webserver is content agnostic, for the most part. It shouldn't change any of the documents being sent to the client, certainly not in the way you describe. Is this a public site we could look at?
stimms
Unfortunately the project is a government project so I'm not able to prodcuce a demo. I updated the post with a sample snippet. Do you see anything based on the way I'm injecting css into the dom that might cause an issue?
ringerce
One other note. On my local dev server I've got each site setup on different ports so for ex. http://localhost:99/ is the location for this project. That's the only difference I can see.
ringerce
A: 

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.

Mohamed Meligy
I added a sample like you specified.
ringerce
Oh, I did try the adding the fix above and still the same result.
ringerce
A: 

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

Graham
I reinstalled IIS and it seems to work fine now.
ringerce
A: 

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.

Woworks