Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome on iOS shows weird url for jQuery Mobile page (ASP.NET MVC)

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

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

like image 596
Cotten Avatar asked Feb 20 '23 23:02

Cotten


1 Answers

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>
like image 191
Darin Dimitrov Avatar answered May 01 '23 17:05

Darin Dimitrov