Chrome on iOS shows weird url for jQuery Mobile pa

2019-01-25 21:27发布

问题:

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")

...I am taken to myapp.com/Home/Download

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

Anyone have any idea why the url get so messed up? (From that url no subsequent link works..)

Thanks!

回答1:

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.

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" />

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>


回答2:

I had the same problem and,

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

solved my problem..

I thing you have to force browser for using cookies because when I checked my settings on my ipad, chrome was already allowing them.

Thanks again..



回答3:

I realize this is an older post, but..

I believe this is a bug with the newest release of chrome iOS v 30.0.1599

As Daren stated this is the .net framework using the URL to hold the authentication data that otherwise would be in the auth cookie. This is called cookieeless session.

.net should not be interpreting the user agent as one that does not support cookies.

I added testing Request.Browser.Cookies to my login page and am seeing this version of chrome showing as false. This is certainly a bug in the chrome release. This seems to only happen after some post backs and will not resolve itself even with clearing the cookies and data and cashe the content settings.

The only way to solve is uninstalling chrome and using Safari. I am using ios7.

I would live to know how to resolve this but currently we are advising our clients who use iOS chrome to not update or use Safari and uninstall....

Mark