Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect IE8 in ASP.NET MVC4

I am looking how to detect IE7 and IE8 browser in MVC4, how to do that?

I find the property Request.Browser but it do not gives any information about browser.

like image 945
Tomas Avatar asked Apr 05 '13 12:04

Tomas


People also ask

What is ASP NET MVC 4 data access hands-on lab?

ASP. NET 4.x In ASP.NET MVC 4 Models and Data Access Hands-on Lab, you have been loading and displaying data from the database. In this Hands-on Lab, you will add to the Music Store application the ability to edit that data.

How to prevent users from entering wrong data in MVC?

Lastly, you will let users delete an album and also you will prevent them from entering wrong data by validating their input. This Hands-on Lab assumes you have basic knowledge of ASP.NET MVC. If you have not used ASP.NET MVC before, we recommend you to go over ASP.NET MVC Fundamentals Hands-on Lab.

How to add validation to the application in MVC?

You can add validation to the application by adding Data Annotations to your model class. Data Annotations allow describing the rules you want applied to your model properties, and ASP.NET MVC will take care of enforcing and displaying appropriate message to users.


1 Answers

I advise you to use 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
}
like image 136
Nikolay Kostov Avatar answered Oct 15 '22 22:10

Nikolay Kostov