IIS displaying page differently when localhost is used in URL vs. hostname

I know this is an old thread, but I just hit the same problem. If you are using IE8, the issue may be its Compatibility View. By default, sites in your local intranet - but NOT localhost - are rendered in IE7 compatibility view. More info here:

http://msdn.microsoft.com/en-us/library/cc288325%28VS.85%29.aspx

Unfortunately, that doesn't help get rid of the disabled scrollbar, but it does explain the discrepancy.


The problem resides in the IE8 compatability view settings. By default, intranet sites (your server) are displayed in compatibility view. To override this behaviour you should add the following code to your code behind of your aspx page.

protected override void OnPreInit(EventArgs e) {
    Response.AddHeader("X-UA-Compatible", "IE=8");       

    base.OnPreInit(e);
}

It worked for me.


In IE9, sites running on localhost are automatically rendered in Compability Mode. To change this (default) behaviour, do this:

  1. If not activiated, activate the toolbar Command
  2. Click Page > Settings for Compabilitymode
  3. Uncheck "Display intranetsites in compabilitymode"

Tags:

Css

Iis