I have seen a couple of support calls recently that seem to center on various customer ASP.net websites that are not working well (or at all) with Internet Explorer 11. The issues are mostly centered on functionality available on the site’s pages that works well in Internet Explorer 11 in compatibility mode or in other browsers, such as Chrome or Firefox, but not in IE 11 standard.
Through this blog post I will try to provide you with some basic things to check to make sure that your site is able to work well with IE 11 in standards mode. But first thing first: what happens when you switch from IE 11 standards mode to compatibility mode or inversely?
The browser changes the user agent string – which is a part of the request that is sent to the web server and which allows the web-server to identify the type of browser that is requesting a page when switching from compatibility mode to standards or inversely. The user agent is most useful when you are trying to adapt the way the site renders based on the browser that is used to view your web-application: the output for mobile is not the same as for desktop browsers, and might be different from older browsers like IE 6 – which people should not be using anymore – but in reality it is still there.
When you switch to compatibility mode in IE 11, the browser will send the user agent string of Internet Explorer 7, and will also use the Internet Explorer 7 rendering engine to try and render the output that comes back from your site. It might not be a good idea to try and switch your site to compatibility mode to get it to work with IE 11.
- ASP.net parsing of the user-agent string.
After you download and install the fix that corresponds to your version of ASP.net and the Windows operating system that is running on the machine that is hosting your website, you might still be wondering if your site will be able to recognize IE 11 correctly – and if you do not have install issues for the fix.
[Post Edit 3 – running ASP.net 4.5? – Read on…]
With ASP.net 4.5 the runtime is correctly able to detect the capabilities of the Internet Explorer 11 browser – however, the name of the browser will show up as ‘Mozilla’. The in place update for the .Net Framework to 4.51. will allow you to also have the correct name of the browser coming up – that is ‘InternetExploerer’ and not ‘Mozzila’
[Post Edit – running ASP 3.5? Read On…]
For ASP.net 3.5, you will need to install two fixes: you will need to install the fix for the .Net Framework 2.0 and the fix for the .Net Framework 3.5 for the target OS you are running on. This will ensure that you are able to correctly parse the IE 11 user agent correctly. Installing just the fix for ASP.net 3.5 will not correct the problem, and the sample test page will still show Mozilla as a browser name.
- ASP.net Browser Test Page
The fastest way to detect if the ASP.net Runtime is correctly able to detect and recognize IE 11, is to use the sample test page below. I have place the source code for the page below, you just need to copy and paste the code into a notepad file and save the file with an .aspx extension (such as BrowserTest.aspx).
<%@ Page Language=”C#” AutoEventWireup=”true” %>
<form id=”form1″ runat=”server”>
Browser name is: <%= Request.Browser.Browser %>
I suggest you create a new website in IIS, so that you make sure that you are not inheriting settings that are set at the level of the website you will be hosting the page in. This will allow you to start with a clean configuration that inherits directly from the base settings for ASP.net defined by the .Net Runtime.
Place the page inside the site, and attempt to connect to the page using the Internet Explorer 11 browser. The page’s code will just examine and print out the value of the Browser.Browser variable, which will contain the name of the browser used to request the page. This variable is populated by the ASP.net Runtime when the request reaches the server, after the query string has been inspected and parsed.
Should the output show a value of ‘Mozilla’ for IE 11 running in standards mode, then you have a problem with the installed fix – or you did not install the correct fix on your machine. Should you see an output value of ‘InternetExplorer’ the runtime is correctly able to detect the IE 11 browser running in standards mode.
- App_Browsers folder in your website
If you have passed the test of the webpage, but your site still does not work, the next thing to do is to move the test page in the root folder of your website. It is very likely that your website defines more settings than the default set defined by ASP.net. It is these settings which most likely break the parsing mechanism and do not allow your site to correctly detect the browser version.
If you see that the output of the test page when it runs in your website is ‘Mozilla’ when it was ‘InternetExporer’ in the test site, there are settings that apply only to your website that break the parsing mechanism of ASP.net which allows the detection of IE 11. These settings are most likely located in the App_Browsers folder: this folder contains .browser files which tell ASP.net how to parse user agents, settings which override the ones defined by ASP.net. If you find yourself in this case, you can try removing the .browser files from the App_Browsers folder and retry the test page: you will see that the output changes back to ‘InternetExplorer’ from ‘Mozilla’.
- Remember IE is not InternetExplorer
Finally, you also need to check your site’s logic. The browser parsing mechanism in ASP.net will show a browser name of ‘IE’ for Internet Explorer version and 10 and below. Starting with IE 11, the browser name parsed out by ASP.net will be ‘InternetExplorer’. Hence if your site’s logic tests if the browser name is equal to ‘IE’, then IE 11 will break your website’s logic and you should change your site’s code to allow for the new browser name.
[Post Edit 2: keep in mind X-UA-Compatible]
Should you see that your site does not work correctly with Internet Explorer 11 event after taking these steps, you may want to look into the usage of the X-UA-Compatible http header or page tag. This parameter instructs IE type browsers witch rendering engine to use when displaying your page. Setting a value of IE=10 will instruct IE 11 for example to use the IE 10 rendering engine. As a final word, please also not that you can chain values in the X-UA-Compatible attribute, so a value of IE=8,9,10 is legal. An IE type browser will evaluate the values and use the one that corresponds to the highest version of the rendering engine it is equipped with (for example an IE 9 will use the IE 9 engine to render the page for the example above). You can find out more about the usage of the X-UA-Compatible tag here:
Hopefully, this will allow you to iron out issues you see when using ASP.net and IE 11.