15

Has anyone managed to get ASP.NET Forms Authentication (with cookies) working with a PhoneGap based mobile application?

I have come across the following questions about managing cookies within PhoneGap and configuring the server properly:

But unfortunately neither of these solutions work. The requests coming from a PhoneGap application do not indicate an authenticated user even though when I run the same dashboard.html code as a file in Safari the requests show up as authenticated.

Community
  • 1
  • 1
Andrew Thompson
  • 2,396
  • 1
  • 21
  • 23

4 Answers4

4

SOLUTION:

cookieless="UseCookies" in web.config FINALLY did it for me:

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

REF: https://groups.google.com/forum/?fromgroups#!topic/phonegap/Thj0fS2GDh4

capdragon
  • 14,565
  • 24
  • 107
  • 153
0

You may use in web.config , cookieless="UseCookies" in authentication tag

0

As I don't know your requirements, this may be a silly answer, but, why you don't consider in this case to deliver the functionality not from a ASP.NET service but from a WCF/Service Stack service?

I'm currently working also in a PhoneGap application but it is served by a REST web service (Service Stack) and I think this kind of architecture offers a lot of flexibility.

Rafa
  • 2,328
  • 3
  • 27
  • 44
0

If you're creating a cookie in a phonegap app, you're basically creating a cookie for the localhost. When you go out to the .net server, that server can't see that cookie.

This is very general, but I hope that this helps a little?