3

I have a problem using cookies and phonegap on the iphone in combination with an ASP 6.0 server.

The login mechanism is as follows:

On start of the app, we check against an URL to check if the user cookie is still valid. We redirect to a login view, perform the login on the server, the server also sends back a cookie.

Then we redirect to the main page of the app. There it is being checked if the user is logged in, but the answer from the server is: "Not logged in".

It seems that though we have a cookie, it's not valid so the server won't recognize us again.

I've seen a similar question with a ASP.NET server, using a .browser file on the server side, because the UIWebView wasn't recognized as Safari but as Mozilla which caused the problem. But this is a ASP 6.0 server and I don't know how to handle that.

Tobi
  • 168
  • 1
  • 12
  • Seems we have now fixed the problem partially, BUT it only works in the iPhone/iPad 4.3 Simulators, NOT on iOS5 Simulators. Does anybody know a resolution? – Tobi Jan 02 '12 at 18:19
  • It seems it's been propably a problem with our usage of JSONP which doesn't work on iOS5+cookies. – Tobi Jan 03 '12 at 07:46

1 Answers1

0

this is what helped us to enable cookies on iOS5+ (should be located within the application:didFinishLaunchingWithOptions function):

NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage]; 
[cookieStorage setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways];
Zathrus Writer
  • 4,311
  • 5
  • 27
  • 50
  • also, you may want to check http://stackoverflow.com/questions/4158550/problem-with-asp-net-forms-authentication-when-using-iphone-uiwebview – Zathrus Writer Aug 14 '12 at 11:49