13

I have googled around for the answer to this question, but haven't come up with anything. Maybe the search terms I used were too generic... Anyway, here goes:

I am discovering the joys of web design and ASP.NET, and the nightmare of trying to get things to display in the same way in IE and all the other browsers. I am working in VS2010 and debugging my website using IE8. What I really don't get is why the website once I publish it looks different in IE from the way it looks in debug mode... I mean small things only, like border in gridviews disappearing in the published site, simple html horizontal rules aren't the same either.

It also messed up my list menu pretty bad, but I managed to fix that with the *display: inline; hack. The weird thing is that it doesn't need it in debug mode, but needs it for the published website.

I am hosting the site on my own machine, running Win XP Pro and hosting through IIS with .NET 4.0... Could the issue be IIS related?

Any help would be much appreciated, because those differences are just ridiculous and are driving me to desperation. I wish everyone over here would use Chrome or Safari, but unfortunately IE still rules in Japan...

David
  • 133
  • 1
  • 1
  • 4
  • are you looking at the site from the exact same browser? no compatibility mode etc? – JohnIdol Mar 02 '11 at 09:12
  • Can you provide screen shot of the two and preferably highlighting the differences? No, IIS won't make this happen. This is not an IE problem per-se. – Shiv Kumar Mar 02 '11 at 09:15
  • @JohnIdol - Yes, the same browser on the same machine. The appearance of the website does not change with Chrome, Safari or Opera, but it is different with IE... – David Mar 03 '11 at 15:03
  • @Shiv Kumar - I'll try to put up screenshots if i can figure out how. I think you are right though in that it is not IIS, since in that case all browsers should be affected. – David Mar 03 '11 at 15:04

5 Answers5

11

This works for me, overrides the setting in ie

META Tag in HEAD element of your web page (or better in master page)

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

link here to info http://blogs.msdn.com/b/askie/archive/2009/03/23/understanding-compatibility-modes-in-internet-explorer-8.aspx

kgp4death
  • 111
  • 1
  • 2
7

I find it better to override compatibility in the HTTP Reponse Headers in IIS, adding header:

X-UA-Compatible: IE=Edge

The IE=Edge part will set compatibility to use the highest mode available, will apply to all users, and also apply to all pages in the site whilst only having to put the header in one place.

biegleux
  • 13,179
  • 11
  • 45
  • 52
Andrew Trevers
  • 1,246
  • 8
  • 10
  • This is the route I went. The website I am working with uses framesets instead of a master page, so adding this to every ASPX header would just be impractical. Adding it to my website in IIS was the ticket. – oscilatingcretin Oct 01 '13 at 12:24
  • Just to "piggyback" off Andrew here, if anyone is having trouble with this in IIS, the same can be done in your web.config file. Place the following `` under your `` tags and IIS will pick up this and add it to it's settings. – haag1 Jan 10 '19 at 14:07
6

I've seen similar behavior related to trusted sites/intranet sites/internet sites security settings. When you run in debug mode is the URL you are using different from when you publish it? I've seen sometimes when I debug using a URL like http://localhost/xxx and when I access the same site straight from IIS using a URL like http://machinename.domain.com/xxx that one resolves to a trusted site or local intranet and the other to internet and it changes the appearance based on the IE settings.

GunnerL3510
  • 715
  • 3
  • 15
  • I guess that could be it. When I debug it does run via the localhost/website address, whilst when I deploy it access goes via the machine/website address like you said. I'll check it out tomorrow, see if I can twiddle the settings to get it to go away. – David Mar 03 '11 at 15:10
  • That is it. IE defaults to a trusted site when the domain name does not include ".". Just tested it by accessing the site via http://ComputerName/SiteName and http://ComputerIP/SiteName. The site displays as it should when accessed by specifying the IP. What a pain. Thanks much for you help! – David Mar 03 '11 at 23:42
  • Glad I could help. This one still causes me problems on a near weekly basis. Looks perfect, then it goes to test and it comes back because it doesn't look right. Drives me crazy. – GunnerL3510 Mar 04 '11 at 01:41
  • Wow, this helped me too thanks! Does that mean that we should always boot up from VS2010 via the ip address and not the localhost? – Diskdrive Apr 13 '11 at 01:39
  • 1
    I've done a bit more research on this it is the "Display intranet sites in Compatibility View" setting in the Tools->Compatibility View Settings menu of IE8 and IE9. If your web application is going to be deployed on an intranet this might be a problem because this is on by default. If not, turn it off on your dev machine and it will appear normally. – GunnerL3510 May 05 '11 at 06:56
1

For those using ASP.NET MVC, you can add kgp4death's

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

to the head element in your _Layout.cshtml.

sabastienfyrre
  • 467
  • 1
  • 4
  • 14
0

I think you did not have given the correct path in the <script src="path">. Please check your path and also check the related file u must place this file in the project folder

I hope this suggestion solve your problem

Michał Turczyn
  • 32,028
  • 14
  • 47
  • 69
Juely
  • 1