FormsAuthentication on ASP.NET sites with the Google Chrome Browser on iOS
A few people have said that they have noticed problems the new iPhone/iPad Google Chrome apps as well as trouble with applications that use hosted Safari inside of UIWebView (which is what Chrome is) or apps that host a website in PhoneGap. If you're using FormsAuthentication (in WebForms or MVC, doesn't matter) then Google Chrome for iOS might switch FormsAuth to Cookieless mode, which sucks for everyone.
This has been fixed in .NET 4.5 and you won't see this problem if you have .NET 4.5 installed, even if you're running a .NET 4 application. For example, Bing.com is running .NET 4 applications under .NET 4.5 RC and wouldn't see this. If you install 4.5 (now or later) ASP.NET will always assume clients support cookies.
If you want to tell ASP.NET 4.0 or earlier that EVERY browser supports cookies for FormsAuth you can do ONE of these things:
1. Change Generic.Browser for your app (or machine)
Make a file called generic.browser in a folder called App_Browsers and put this in it:
<browsers>
<browser refID="GenericDownlevel">
<capabilities>
<capability name="cookies" value="true" />
</capabilities>
</browser>
</browsers>
2. Force Cookieless=UseCookies in your web.config
Add cookieless="UseCookies" for your forms element in web.config.
<authentication mode="Forms" >
<forms loginUrl="~/Account/LogOn" timeout="2880" cookieless="UseCookies" />
</authentication>
Hope this helps.
Related Links
About Scott
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
About Newsletter
Is there anything else which can be done?
Thanks SH for the nuggets of wisdom that help keep things rolling over here!
I am facing same issue on IPAD but scenario is when user clicks on "remember me" user is authenticated and cookie is set.But after few hours only on IPAD cookie expires giving 500 internal server error.I have used Approach 1 and Approach 2 of above mentioned suggestions.
Still no success. What is the root cause of this Issue.
Please can you explain !!
Was going crazy, not being able to figure this out.
Thanks Regards
Parm
Comments are closed.
I was just getting ready to start debugging.