Detect IE8 in ASP.NET MVC4

I'm looking for how to detect IE7and IE8browser in MVC4, how to do it?

I find the property Request.Browser, but it does not provide any information about the browser.

+5
source share
2 answers

I advise you to use the Contains method on Request.UserAgent

if (Request.UserAgent.Contains("MSIE 7.0"))
{
    // Internet Explorer 7
}
else if (Request.UserAgent.Contains("MSIE 8.0"))
{
    // Internet Explorer 8
}
+10
source

Another option if you want <= 8:

Request.Browser.Browser == "IE" && Request.Browser.MajorVersion <= 8;
0
source

All Articles