iPhone & 51degs.mobi 集成在 ASP.NET MVC 网站中

发布于 2024-12-25 06:18:20 字数 797 浏览 2 评论 0原文

我正在提供我的 ASP.NET MVC 网站移动版本。假设网站为 www.mywebsite.com,移动版本为 www.mywebsite.it/Mobile

作为第一个功能,我将能够识别移动设备是否正在调用 www.mywebsite.com,如果是这种情况,我将简单地将访问者重定向到 www.mysite.com/Mobile。

为此,我将 51 Degrees.mobi API 集成到我的网站中,如 http://51 Degrees.codeplex.com/wikipage?title=MVC,我用真机 iPhone 进行了测试。

首次访问 www.mywebsite.com 会被正确重定向到 www.mywebsite.com/Mobile,并且设备、iOS 和浏览器都会被识别。很好,这就是我正在寻找的。

不幸的是,当我再次尝试输入 www.mywebsite.com 时,iPhone 加载了主主页 www.mywebsite.com/home,而没有重定向到移动区域。

我非常确定第一次访问效果很好,因为它是由 web.config 文件直接管理的。

那么,我错过了什么?这是缓存或会话相关的问题吗?我该如何修复它?

问候, 马可

I'm providing my ASP.NET MVC website with a mobile version. Let's say that the web site is www.mywebsite.com and the mobile version will be www.mywebsite.it/Mobile.

As first capability I would be able to identify if a mobile device is invoking www.mywebsite.com and, if it is the case, I would simply redirect the visitor to www.mysite.com/Mobile.

To do this, I integrated the 51degrees.mobi API into my website, as described in the Method 2.2 of http://51degrees.codeplex.com/wikipage?title=MVC, and I used a real iPhone to test it.

The first access to www.mywebsite.com is properly redirected to www.mywebsite.com/Mobile, and the device, the iOS and the Browser are identified. Fine, this is what I am looking for.

Unfortunately, when I had tried again to type www.mywebsite.com once more the iPhone loaded the main home page www.mywebsite.com/home without redirecting to the mobile area.

I'm quite sure that the first access worked well because it is managed by the web.config file directly.

So, what am I missing? Is this a cache or session-related issue? How can I fix it?

Regards,
Marco

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蒲公英的约定 2025-01-01 06:18:20

Marco,

我怀疑您将firstRequestOnly 属性设置为true,这是默认值。请参阅此链接的用户指南第 2.1 节。

http://51 Degrees.mobi/Support/Documentation/Foundation/UserGuide.aspx

只需将 firstRequestOnly 更改为 false,51Degrees.mobi 就会按照您的要求工作。

默认行为仅重定向第一个请求,因为在许多情况下,开发人员希望为用户提供导航到网站的标准非移动版本的选项。

James - 51Degrees.mobi 创始人

Marco,

I suspect you have the firstRequestOnly property set to true which is the default. See section 2.1 of the User Guide at this link.

http://51degrees.mobi/Support/Documentation/Foundation/UserGuide.aspx

Simply change firstRequestOnly to equal false and 51Degrees.mobi will work as you require.

The default behaviour only redirects the first request because in many cases developers want to give the option for users to navigate to the standard non-mobile version of the web site.

James - 51Degrees.mobi Founder

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文