Asp.net mvc 如何在MVC中获取移动设备信息,如移动设备名称、型号
如果用户正在移动设备上使用web应用程序,如何获取移动设备信息。我试过了,但没有真正起作用,它显示了未知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&
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);
}
}