Showing posts with label IE7 Standards. Show all posts
Showing posts with label IE7 Standards. Show all posts

Monday, October 22, 2012

FIX: IE Document Mode changes to IE 7 while opening a remotely hosted ASP.NET (or MVC) website in Internet Explorer 8

A recent issue I faced while I deployed my ASP.NET MVC application on production server.

I hosted my MVC application on a web server having IIS 7.
While I tried to access that website on the server itself using "localhost" in URL within IE 8 browser, it was getting displayed perfectly. But when I tried to access it remotely in IE 8 browser, the layout got disturbed, and it was appearing too messy.

I did a lot of investigations, and could found this is because by default browser was opening the website under "IE 7" document mode.



In order to prevent this, I did following changes <system.webServer> section in web.config file of my application, and that successfully resolved this issue:

<system.webServer>
    <httpProtocol>
      <customHeaders>
        <clear />
        <add name="X-UA-Compatible" value="IE=edge" />
      </customHeaders>
    </httpProtocol>
  </system.webServer>