【问题标题】:51 degrees how do not detect IPad as mobile device51 度如何不将 iPad 检测为移动设备
【发布时间】:2014-08-14 05:57:36
【问题描述】:

我的 .net mvc4 应用程序的区域名为“Mobile”,在我的 web.config 文件中 51 度配置为将移动设备重定向到该区域:

  <redirect firstRequestOnly="false" mobileHomePageUrl="~/Mobile" timeout="20" devicesFile="~/App_Data/Devices.dat" mobilePagesRegex="Mobile"></redirect>

如何配置 51 度以不重定向 iPad。或者换句话说:忽略 iPad 作为移动设备?

我尝试添加“位置”:

<locations>
  <location name="Mobile" url="~/Mobile">
   <add property="IsTablet" matchExpression="false"/>
   <add property="IsMobile" matchExpression="true"/>
  </location>
</locations>

这无济于事......

【问题讨论】:

    标签: asp.net-mvc asp.net-mvc-4 51degrees


    【解决方案1】:

    我为自己的问题找到了解决方案。 在 web.config 文件中:

    <redirect firstRequestOnly="false" mobileHomePageUrl="~/Mobile" timeout="20" devicesFile="~/App_Data/Devices.dat" mobilePagesRegex="Mobile">
    <locations>
    <location name="noredirect" url="">
              <add property="Url" matchExpression="[&amp;|\?]noredirect"/>
            </location>
          </locations>
    </redirect>
    

    在移动区域默认控制器中:

    if (Request.Headers["User-Agent"].ToLower().Contains("ipad"))
                {
                    return Redirect("someurl?noredirect=true");
                }
    

    【讨论】:

      猜你喜欢
      • 2022-01-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-09-06
      • 2015-01-06
      • 1970-01-01
      相关资源
      最近更新 更多