Override X-UA-Compatible parameter in web.config for specific pages and frames

I have a .Net web application that enables web.config to force Internet Explorer to disable compatibility mode and use the latest version of IE:

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

However, this application contains an outdated page that requires compatibility mode. In my testing, it will only be displayed when X-UA-Compatible set to IE=5 .

Is there a way to override the web.config parameter for one page?

Among the many things I tried that didn't work:

  • Including <meta http-equiv="X-UA-Compatible" content="IE=5" /> on the page itself, as the first tag after <head>
  • Adding X-UA-Compatible:IE=5 to the response headers. Unfortunately, it also sends an X-UA-Compatible:IE=Edge header X-UA-Compatible:IE=Edge , and that one wins.
  • Change to <!DOCTYPE > . I tried all the different options.
  • Adding a comment before DOCTYPE
  • Record the page to meet standards. This is obviously the best solution, but the page in question is a complex application for matching, and re-recording will take several months.

Update
When I called it a “sophisticated mapping application,” I had to say “rat nest of frames and tables.” It turns out that part of the frames is related to the decision.

+6
source share
2 answers

I finally got this fix by putting this code in the Page_Load () page of each page, which is part of the frameset for this page (about ten pages in total).

 Response.ClearHeaders(); Response.AddHeader("X-UA-Compatible", "IE=5"); 

I assumed that the frameset pages inherit the setting from the main page, but apparently not. It just didn’t work to put it on the main page, I had to put it on every page / frame.

+8
source

You can try using the location tag ...

 <location path="YourPage.aspx"> <system.webServer> <httpProtocol> <customHeaders> <add name="X-UA-Compatible" value="IE=5" /> </customHeaders> </httpProtocol> </system.webServer> </location> 
+1
source

Source: https://habr.com/ru/post/972870/


All Articles