5

我正在使用 51degrees API 进行移动重定向:http: //51degrees.codeplex.com/

当使用 51degrees 检测到移动设备时,我只能使用 51degrees 配置从任何桌面页面重定向到移动主页。即http://www.mydomain.com/somepagehttp://m.somepage.com/default

我无法做的是重定向到同一页面,即从http://www.mydomain.com/somepagehttp://m.somepage.com/somepaage

是否可以重定向到同一页面?

4

2 回答 2

5

选项 1:仅对移动检测部分使用 51 度并自行连接重定向。从您的 web.config 中删除该<redirect>元素并在 Global.asax 文件中尝试这样的操作:

void Application_BeginRequest(object sender, EventArgs e)
{
    if (HttpContext.Current.Request.Browser.IsMobileDevice)
    {
        Response.Redirect("http://m.mydomain.com" + Request.RawUrl);
    }
}

选项 2:在<redirect>web.config 文件的元素中,添加 property originalUrlAsQueryString=true这将向移动主页发送一个名为origUrl的查询字符串,让您可以选择重定向到所请求页面的移动版本。

于 2011-09-30T19:03:47.790 回答
0

您可以在 51Degrees.mobi用户指南中的第 2.1.2 节中找到有关如何将其配置为重定向到页面的移动版本的信息。

于 2012-02-20T16:48:35.350 回答