How to a page in IE render differently between Cassini and IIS7

cassiniiis-7internet-explorer-8

I am completely confused – I have a website that renders perfectly in IE8 when run through Cassini (in Visual Studio) but has several messed up elements (style/look) when deployed to localhost and viewed through the same browser (IE8).

I have run Beyond Compare 3 on the html and CSS files and they are exactly the same. Are there any circumstances where IIS7 could be somehow sending extra/different information to the browser? Has anyone run across something like this before?

Note that Chrome and Firefox both render the same webpage just fine through Cassini and IIS7.

(Update)
What Browser Mode and Document Mode does IE8 Developer Tools think you are in if you press F12?

When running from Cassini (http://localhost:22120), IE8 stays in IE8 mode (with the option for turning on IE7 compatibility view) and everything looks great.

When running from IIS7 (http://{machine name}), IE8 automatically goes into in IE8 Compat View, IE7 standards and things look horrible.

Best Answer

My assumption (as mentioned in my comment earlier) was that IE is working in a different rendering mode, depending on whether you are using IIS or Cassini, and this is causing the layout differences. It actually appears to be IE that is causing this, based on the settings found in Tools | Compatibility View Settings. There are two check boxes:

Display intranet sites in Compatibility View - this is checked by default. Display all websites in Compatibility View - this is not.

Either way, you should use the standard meta tag to force the mode you wish to be rendered in.

<meta http-equiv="X-UA-Compatible" content="IE=8" />

Hope this helps.

Related Topic