I'm having (yet another) strange problem with IIS. When viewing an ASPX page I've designed on my local machine by browsing to http://localhost/page.aspx
the page looks as expected (and looks the same in IE, Firefox and Chrome. If I change localhost
to my_hostname
the page is rendered with a disabled vertical scroll bar.
The behavior was first noticed when I published my site to our live server and saw the same discrepancy. After beating my head against the wall I tried what I described above and was able to duplicate my "problem". So with that, I turn to you guys.
This wouldn't really be an issue (save for the cross-browser inconsistency) except that this screws up an "absolute"ly positioned <div>
moving it partway off the screen instead of being centered like it should be (and is when viewed any other way except in IE when the address is anything but localhost).
As another test I added a new aspx page to my project and didn't add or change any of the default code. If I browse to the page using localhost there is no scrollbar. If I browse to the page using my_hostname the scrollbar is there. Whatever the difference is it's making IE's processing of CSS get screwed up, to the point where at first everything works the same in all browsers I'm testing in, and afterwards IE just makes up its own rules. This is incredibly frustrating and I'm really hoping I'm just doing something wrong and it's not an inherent problem.
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.
It worked for me.
In IE9, sites running on
localhost
are automatically rendered in Compability Mode. To change this (default) behaviour, do this:Here's a post on StackOverflow about this
basically change the top of your HTML Layout or MasterPage(after the
<%@...%>
) to:CSS shouldn't be affected by the URL. Any chance you have hidden text with the URL somewhere in the body that is causing it to shift? If you view the source of the file in both situations using a tool like http://www.quickdiff.com/, is there anything different between them?
The fix that @Claire applies to IE 11 as well. I was having issues where css was not being applied when accessing the site via the host name of the server, but localhost displayed fine.
To Fix:
I'm not sure why localhost is not considered an intranet site though.
Just to state I was having a similar issue as the OP and applying the code Serj Sagan suggested to my site master page but changed IE=Edge to IE=11, now when published it all displays as it should.