Start with
[NSHTTPCookieStorage sharedHTTPCookieStorage].cookieAcceptPolicy = NSHTTPCookieAcceptPolicyAlways;
But, as @JoelFan has already been mentioned, the problem may be your User Agent string, causing ASP.NET to try and fail when logging into cookieless. Instead of an answer that includes
Set-Cookie: .ASPXAUTH = really-long-hex-number
it returns a redirect to something like
Location: / (F (long-sorta-base64ish-look-string)) /
The default UIWebView user agent string looks like
User-Agent: Mozilla / 5.0 (iPad, CPU OS 7_0_2, like Mac OS X) AppleWebKit / 537.51.1 (KHTML, like Gecko) Mobile / 11A501
but ASP.NET doesn't like it. Safari is sending something like this:
User-Agent: Mozilla / 5.0 (iPad, CPU OS 7_0_2, like Mac OS X) AppleWebKit / 537.51.1 (KHTML, for example, Gecko) Version /7.0 Mobile / 11A501 Safari / 9537.53
Do the following early on, perhaps in your AppDelegate.m
source share