I have a .Net web application that includes a web.config setting to force Internet Explorer to turn off compatibility mode and use the most recent version of IE available:
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="X-UA-Compatible" value="IE=Edge" />
</customHeaders>
</httpProtocol>
</system.webServer>
However, this application contains a legacy page that requires Compatibility mode. In my testing, it will only display properly when X-UA-Compatible
is set to IE=5
.
Is there a way to override the web.config setting for a single page?
Among the many things I have tried that have not worked:
<meta http-equiv="X-UA-Compatible" content="IE=5" />
on the page itself, as the first tag after <head>
X-UA-Compatible:IE=5
to the response headers. Unfortunately, it also sends the X-UA-Compatible:IE=Edge
header, and that one 'wins.'<!DOCTYPE >
. I tried all the various options.Update
When I called this "a complex mapping application," I should have said "a rat's nest of frames and tables." It turns out that the frames part was relevant to the solution.
I finally got this fixed by putting this code in the Page_Load() of every page that is part of the frameset for this page (about a dozen pages in total).
Response.ClearHeaders();
Response.AddHeader("X-UA-Compatible", "IE=5");
I had been assuming that the frameset pages would inherit the setting from the main page, but apparently not. Just putting that on the main page did not work, I had to put it on every page/frame.
You could try using a location tag...
<location path="YourPage.aspx">
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="X-UA-Compatible" value="IE=5" />
</customHeaders>
</httpProtocol>
</system.webServer>
</location>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With