According to Microsoft's documentation for HttpCapabilitiesBase.Browser Property, you can check for Internet Explorer using the following code.
System.Web.HttpBrowserCapabilities myBrowserCaps = Request.Browser;
if (((System.Web.Configuration.HttpCapabilitiesBase)myBrowserCaps).Browser.ToUpper().IndexOf("IE") >= 0)
{
labelText = "Browser is Internet Explorer.";
}
else
{
labelText = "Browser is not Internet Explorer.";
}
In my MVC application the following code is returning InternetExplorer NOT IE
string browser = HttpContext.Request.Browser.Browser;
With IE's Developer Tools I can change the user agent string to any of the IE's other than Default and they return IE as documented, but default returns InternetExplorer.
Why would they change that string to InternetExplorer? And is there any documentation out there why they would have done this?
Had a couple customers who were being blocked by my portal because of this (out of hundreds who are getting in on IE11).
The two customer's ie version were Explorer 11.0.9600.17691 CO and 11.0.9600.97843IS
Those are custom builds of IE: https://support.microsoft.com/en-us/kb/969393
Downloaded Windows 7 IE11 from and installed into Oracle VM VirtualBox.
Then downloaded IEAK. https://technet.microsoft.com/en-us/ie/bb219517.aspx English. Strangely enough the installer to make c:\builds\07072015 didn't have a drop down for language. I went to control panel and selected English (toggled). Opening up the wizard the dropdown worked.
Ran: C:\builds\07082015\INS\WIN32_WIN7\EN-US\IE11-Setup-Full
Just walked through the wizard not adding or customizing anything. After a reboot:
IE now came up 11.0.9600.17420IS.
Pointing to the a dev site instrumented to dump the
Request.Browser.Browserand it came upInternetExplorer... notIE!This is .NET4.0 on Win7 64bit integrated and Windows 2k12 (didn't check 4.5, 4.5.1, etc). For some reason it detects IEAK differently.
The solution is simple, I'll just make the code allow either.
FYI: useragentstring.com string looked the same Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko