Persisting cookie for iPhone UIwebview mobile web

2019-09-06 18:10发布

问题:

I'm using MVC4 forms auth. My mobile web app runs in full screen UIwebview on iphone. I have a home screen icon for my mobile web app. The app needs to launch external links. Those launch in Safari, which works fine. However returning to the mobile web app by clicking again on the home screen icon, seems to have logged the user out. Ideally I want the user to remain logged into the web app after viewing the external links in Safari. Maybe the cookie got deleted? Can I persist the cookie?

回答1:

FormsAuthentication.SetAuthCookie(username, createPersistentCookie: true);

This fixes the log out issue