I am trying to determine the browser and the version in which our user is accessing our application using the below code:
public bool MyBrowser(HttpRequestBase request)
{
HttpBrowserCapabilitiesBase browser = request.Browser;
switch (browser.Browser)
{
case "IE":
{
if (browser.MajorVersion < 6)
//do something
}
case "Firefox":
{
if (browser.MajorVersion < 3)
//do something
}
case "AppleMAC-Safari":
{
if (request.UserAgent.Contains("Chrome") || browser.MajorVersion < 4)
return false;
return true;
}
default: return false;
}
}
This code is always returning false when user opens the site in IE11, this piece was working fine until we migrated to IE11. What could be the reason why this is happening. Please suggest if there is a workaround.