0

I'm building a site in ASP.NET MVC/C#. I base most of my controllers off of a base controller. In that base controller I handle quite a few common tasks every controller needs to do.

One thing I want to add is a check for mobile browser. I've found some recommendations around SO, but they seem to be outdated.

What's a reliable way to check for mobile browser in C# (ASP.NET MVC)? (note: I already use stylesheet media queries for a responsive UI, but I need a way to detect mobile browser server side)

Chaddeus
  • 13,134
  • 29
  • 104
  • 162

2 Answers2

4

Request.Browser.IsMobileDevice I'm using MVC4 not sure if this will work with regular request object.

Filix Mogilevsky
  • 727
  • 8
  • 13
0

Here's an interesting blog article on Request.Browser.IsMobileDevice: http://dbarrowstechblog.blogspot.com/2011/02/requestbrowserismobiledevice.html It seems like there may be some limitations to this approach.

Overall, it's important to understand the considerable differences between what's called a "mobile device". It can be anything from a very primitive, almost text only, browser on an older phone to an iPhone or Android smartphone to a full featured experience on an iPad or Android tablet.

Tablet and advanced smartphone users hate dumbed down sites and hate sites that interfere with basic functionality like pinch-zoom. They like app'ed sites, when they work well, and sites that are optimized for performance but that are not stripped down to the bare bones.

jfrankcarr
  • 481
  • 3
  • 6