Thursday, May 29, 2014

Incorrect User Agent String for Internet Explorer 11 using .NET v. 4.0

I frequently use Server-Side Browser Detection to enforce rules regarding browser compatibility to prevent people from using non-supported browsers with my application (especially older versions of Internet Explorer).

I was recently testing my Browser Detection library using Internet Explorer 11 and .NET v. 4.0.  Internet Explorer 11 is relatively new to the Windows 7/Windows Server 2008 R2 platform and ONLY ships with Windows 8.1 and Windows Server 2012 R2 so I really had not done much testing with it in the past.

Interestingly enough, I discovered that the browser information for Internet Explorer emulated Mozilla for the .NET v. 4.0 platform!!

Below is a screenshot of the results from running my test application in Internet Explorer 11:



Even more interesting is that this appears to be ONLY a problem with Internet Explorer 11 since Internet Explorer 10 is detected just fine.

As you can probably guess, this issue is already well known and even has a Connect feedback item here: http://connect.microsoft.com/VisualStudio/feedback/details/806542/fix-internet-explorer-11-not-detected-correctly-by-net-4-0-framework-when-custom-browser-files-are-used

This article describes a fix for this issue that does not require changing the version of the application, but rather simply installing .NET v. 4.5 on the target server: http://rikter.com/articles/2013/12/internet-explorer-11-and-asp-net/

After downloading and installing .NET Framework v. 4.5.1 from this link here: http://www.microsoft.com/en-us/download/details.aspx?id=40779, I was able to successfully detect Internet Explorer 11 correctly!


No comments:

Post a Comment