How can a page in IE render differently between Cassini and IIS7?

6.7k Views Asked by At

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.

5

There are 5 best solutions below

3
On 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.

1
On

If the page content is the same then compare the headers that the servers are sending with the page.

After kicking this around a bit I though about compatibility mode. Try manually forcing IE8 to render the page in compatibility mod. If the render doesn't change then you know that the issue is because IE is rendering that page in compatibility mode when reading it from that web server.

If the latter is the case look into http://msdn.microsoft.com/en-us/library/dd567845%28VS.85%29.aspx

0
On

One side note to this issue: if the same page renders differently on different servers but in the same IE8 browser, check your url - IE8 automatically displays in compatibility mode if the domain is not fully qualified.

0
On

Actually I had the same issue. IE8 has a compatability settings dialog under tools menu. There is a check box which indicates "Display intranet sites in compatability mode". And not that IE7 compatability mode is not the same as using ie7, there are some differences.

1
On

I think the best solution I have found is not far from Paul's one but it tells the browser to use your Internet Explorer version which solved other problems I have with content="IE=8".

Here it is:

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