1

我的 .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>

这无济于事......

4

1 回答 1

0

我为自己的问题找到了解决方案。在 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");
            }
于 2014-08-14T06:57:44.183 回答