How does IsMobileDevice work?

Now, after 4 years, it's even more simple

Request.Browser.IsMobileDevice

Since for most sites, it is actually the size of the screen that matters and not so much the capabilities (at least when talking about modern phones with things like Safari and Chrome on them) wouldn't checking the resolution make the most sense?

Request.Browser.ScreenPixelsHeight

and

Request.Browser.ScreenPixelsWidth

A number of *.browser files are shipped with .NET:

C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\Browsers

The runtime uses regular expressions from the *.browser files to match against the incoming User-Agent string, and then sets a bunch of properties based on each match it finds (there can be several in the hierarchy).

If you need in-depth mobile device support, consider installing the MDBF, which adds support for about 400 devices:

http://mdbf.codeplex.com/

Tags:

Asp.Net

Mobile