Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc 如何在MVC中获取移动设备信息,如移动设备名称、型号_Asp.net Mvc_Mobile Devices - Fatal编程技术网

Asp.net mvc 如何在MVC中获取移动设备信息,如移动设备名称、型号

Asp.net mvc 如何在MVC中获取移动设备信息,如移动设备名称、型号,asp.net-mvc,mobile-devices,Asp.net Mvc,Mobile Devices,如果用户正在移动设备上使用web应用程序,如何获取移动设备信息。我试过了,但没有真正起作用,它显示了未知 public class TestController : BaseController { public String IsMobileDevice() { if (HttpContext.Request.Browser.IsMobileDevice) return String.Format("<H1&

如果用户正在移动设备上使用web应用程序,如何获取移动设备信息。我试过了,但没有真正起作用,它显示了未知

public class TestController : BaseController
{
    public String IsMobileDevice()
    {            
        if (HttpContext.Request.Browser.IsMobileDevice)
            return String.Format("<H1>{0}</H1>", HttpContext.Request.Browser.MobileDeviceManufacturer);
        else
            return String.Format("<H1>{0}</H1>", Request.Browser.Browser);                
    }
}
公共类TestController:BaseController
{
公共字符串IsMobileDevice()
{            
if(HttpContext.Request.Browser.IsMobileDevice)
返回String.Format(“{0}”,HttpContext.Request.Browser.MobileDeviceManufacturer);
其他的
返回String.Format(“{0}”,Request.Browser.Browser);
}
}