Redirecting mobile visitors to the mobile version of your site, is a common
How to detect them in ASP.NET?
Solution 1: the native ASP.NET method
class exposes the
IsMobileDevice property, that seems to be the solution to our
Unfortunately the property returns highly inaccurate values, due to the very
basic parsing of the browser user agent.
Solution 2: 51Degrees.mobi
This open source library does a good job, you can install it using
NuGet or directly from the
51Degrees project site.
When you install this free component, it comes along with with a data file that
contains all the detailed user agents information of all the mobile phones in
The only thing you have to do, is to periodically refresh this data file.
From a programmers prospective, you can configure an automatic redirection
directly using configuration parameters in your
config file, or you
can manually test the extended
property that now return accurate results.
But there's a problem!
If you have to distinguish between smartphones and tablets, with this
solution you can't or better, you can if you switch to the premium paid version.
version 1.x this was possible because the component was based on the
WURFL database (Wireless
Universal Resource FiLe), but with the new 2.x versions this changed as
stated inside the official documentation:
The detection element replaces the
element used ...leggi tutto l'articolo.