iOS 上的 Chrome 显示 jQuery Mobile 页面 (ASP.NET MVC) 的奇怪 url [英] Chrome on iOS shows weird url for jQuery Mobile page (ASP.NET MVC)

查看:17
本文介绍了iOS 上的 Chrome 显示 jQuery Mobile 页面 (ASP.NET MVC) 的奇怪 url的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 jQuery Mobile 页面,可以在 iPhone (iOS 5+) 上的 Safari 中正常工作.当点击此链接时...

I have a jQuery Mobile page that works ok in Safari on iPhone (iOS 5+). And when clicking at this link...

@Html.ActionLink("Click to download", "Download", "Home")

...我被带到myapp.com/Home/Download

当我在 iPhone 上的 Chrome 中点击同一个链接时,我被带到了 myapp.com/(F(LzXF8gDEEPPgR7F_UZ0wf2uWg1e-aK1mgwtvzxCTIgflM43gYVEY06XIIq91OLlyjnRXo78AXHSNRsLHZmTm)/首页/下载

When clicking the same link in Chrome on iPhone I'm taken to myapp.com/(F(LzXF8gDEEPPgR7F_UZ0wf2uWg1e-aK1mgwtvzxCTIgflM43gYVEY06XIIq91OLlyjnRXo78AXHQLoXMUXRjOLKQltEhrsYgmTnSNsHzBfl01)) /Home/Download

有谁知道为什么 URL 变得如此混乱?(从那个 url 没有后续链接工作..)

Does anyone have any idea why the URL gets so messed up? (From that url no subsequent link works..)

推荐答案

您的用户代理(浏览器)不支持 cookie 或禁用了 cookie.在这种情况下,ASP.NET 陷入了一种兼容模式,在这种模式下,它通过在 url 中附加会话 ID 来跟踪用户会话.所以现在你所有的 url 都会有这个 id.这是完全正常的行为.

Your user agent (browser) doesn't support cookies or has cookies disabled. In this case ASP.NET falls to a compatibility mode in which it tracks user Sessions by appending the session id in the url. So now all your urls will have this id. It's perfectly normal behavior.

同样的情况不仅会发生在 ASP.NET 会话上,还会发生在表单身份验证 cookie 上.您可以通过强制始终使用 cookie 来禁用 web.config 中的 ASP.NET 会话的此行为:

The same will happen not only with ASP.NET Session but with Forms Authentication cookies. You could disable this behavior for ASP.NET Session in web.config by forcing to always use cookies:

<sessionState cookieless="UseCookies" />

显然,如果用户禁用 cookie,您的应用程序将直接崩溃,因为它无法跟踪用户.表单身份验证 cookie 也完全相同:

Obviously if the user disables cookies, your application will simply crash as it won't be able to track users. And absolutely the same goes for the forms authentication cookies:

<authentication mode="Forms">
    <forms loginUrl="~/Account/LogOn" timeout="2880" cookieless="UseCookies" />
</authentication>

这篇关于iOS 上的 Chrome 显示 jQuery Mobile 页面 (ASP.NET MVC) 的奇怪 url的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆