0
任何人都可以帮忙吗? 我想使用51Degrees的免费服务而不是Lite版本,但是使用Cloud API(https://51degrees.com/compare-data-options)。Global.asax设备检测与51度云API
我想设置我的Global.asax有对“平板电脑”和“移动”的显示模式,这样我就可以使用:
- index.cshtml
- index.tablet.cshtml
- index.mobile.cshtml
以下工作时不使用51度。 有没有人有过如何整合51度Cloud API与global.asax来筛选平板电脑/手机的例子。
https://51degrees.com/Support/Documentation/APIs/Cloud-API/NET-Cloud
DisplayModeProvider.Instance.Modes.Insert(0, new DefaultDisplayMode("Tablet")
{
ContextCondition = (ctx =>
ctx.Request.UserAgent.IndexOf("iPad", StringComparison.OrdinalIgnoreCase) >= 0 ||
ctx.Request.UserAgent.IndexOf("Android", StringComparison.OrdinalIgnoreCase) >= 0 &&
ctx.Request.UserAgent.IndexOf("Mobile", StringComparison.OrdinalIgnoreCase) <= 0
)
});
感谢 汤米