DeviceDetector.NET icon indicating copy to clipboard operation
DeviceDetector.NET copied to clipboard

How to use this library on Razor pages?

Open DanielDanielDanielD opened this issue 4 years ago • 0 comments

Hi, I am currently using something custom to detect user device and I would like to upgrade to a deeper test with DeviceDetector.NET, is it possible to do this directly on Razor page?

This is my code so far (inside Razor page) for checking the user's device:

// Mobile Detection
string strUserAgent = Request.UserAgent.ToString().ToLower();
var isMobile = false;
if (strUserAgent != null)
{
    if (Request.Browser.MobileDeviceModel != "Unknown")
    {
        isMobile = true;
    }
}

DanielDanielDanielD avatar Sep 15 '21 16:09 DanielDanielDanielD