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?