【问题标题】:Redirect to mobile site using ASP.NET 3.5使用 ASP.NET 3.5 重定向到移动站点
【发布时间】:2018-04-07 03:23:48
【问题描述】:

如果用户使用移动设备或平板电脑,我希望将用户重定向到我的网站的移动版本。

我希望使用 51 Degrees,但他们说它需要 .net 4.0 才能工作,我无法从 3.5 升级。

有谁知道解决这个问题的方法吗?

【问题讨论】:

    标签: asp.net .net-3.5 51degrees


    【解决方案1】:

    我是 51Degrees 的工程师之一。尽管本地 API 不支持 .NET 3.5,但您可以使用可用的云服务。

    您将能够调用我们的 RESTful API,尤其是在这种情况下,使用类似于以下内容的 IsMobile 属性:

    string queryString = string.Format("https://cloud.51degrees.com/api/v1/*LICENCE_KEY*/match?user-agent=" + Request.UserAgent + "&values=ID+IsMobile")
    
    string json = webClient.DownloadString(queryString);
    

    这将返回一个 JSON 对象,然后您可以对其进行格式化并用于重定向。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多