I'm experiencing some strange behavior with the ASIHTTPRequest.
I'm trying to connect to a website which prompt a user to give his/her credentials when loading the page.
To implement this with ASIHTTPRequest i've used the following code:
NSURL *URL = [NSURL URLWithString:@"http://fhict.fontys.nl/Pages/Welkom.aspx"];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:URL];
[request setUsername:theUsername];
[request setPassword:thePassword];
[request setDelegate:self];
[request startAsynchronous];
I'm sure the credentials given to the request are correct, and when i'm working on WiFi the request succeeds and the app continues..
But when i'm connected to cellular network, the exact same request gives an error: error:Error Domain=ASIHTTPRequestErrorDomain Code=3 "Authentication needed" UserInfo=0x2e8ef0 {NSLocalizedDescription=Authentication needed}
I checked, this same error is given when the credentials are incorrect, but i've double checked them and they are correct!
To fix this I've tried:
- setting the timeout on 2 minutes (overkill I know but just for testing), this resulted the same error
- enabled and set bandwidth throttling for WWAN (as described on http://allseeing-i.com/ASIHTTPRequest/How-to-use, search for WWAN), but nothing changed
- setting enabling shouldPresentCredentialsBeforeChallange and adding basichttpheader to the request, but then also WiFi stopped working..
And then a lot of googling later, still no solution.
I'm a little confused because because on WiFi everything works perfectly,
I hope anyone here can point me in the right direction..