我正在寻找一种方法来设置HttpContext.Current.Request.Browser.IsMobileDevice
为真的自定义移动设备不受MVC4和51degrees.mobi,这也是应用程序中使用dedected。如何覆盖Browser.IsMobileDevice是ASP.NET MVC4应用程序?
我在Global.asax.cs中尝试这样做:
protected void Application_PreRequestHandlerExecute(Object sender, EventArgs e)
{
HttpContext.Current.Request.Browser.IsMobileDevice = true;
}
但我得到一个编译错误:
Property or indexer 'System.Web.Configuration.HttpCapabilitiesBase.IsMobileDevice' cannot be assigned to -- it is read only
51degrees.mobi,jQuery的,jQuery的UI和jQuery UI的移动被使用。
谢谢。如果将51degrees.mobi模块添加到应用程序中,它将IsMobileDevice设置为true,以用于其他受到限制的设备。为什么不允许从我的应用程序中更改它? – Andrus
基本上他们所做的是覆盖默认的.net功能。 http://51degrees.mobi/Support/Documentation/NET/WebApplications/RequestBrowserOverwrites.aspx – hjgraca
它们提供了一个像mvc一样的浏览器用户代理列表,但它们的列表更新鲜。 – hjgraca