Detect iPad with ASP.net

Konrad picture Konrad · Jul 5, 2012 · Viewed 11.6k times · Source

I want to detect if a mobile device is an Tablet (iPad) or not in ASP.net I had a look at 51degrees project but the function to detect a tablet isn't available in the free version - and since we distribute our ASP.net solution to 100's of customers, we cannot buy a 51degrees license for all of them.

Are there any free or open source alternatives for 51degrees available? Or will newer versions of MVC (4?) provide more information in detail than the plain IsMobileDevice()?

Thanks, Konrad

Answer

Danny Brady picture Danny Brady · Jul 5, 2012

You can request the user agent and check to see if it contains 'ipad' like so

bool isIpad = Request.UserAgent.ToLower().Contains("ipad");