Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to terminate ASIHTTP connection in iphone?

I am having an issue with ASIHTTPRequest authentication. The steps are in the following order,

  1. User entering wrong username and password -- > No data comes from backend and request failed delegate gets called from ASIHTTPRequest. Then goto login page again.

  2. User enters correct values -- > Data comes as expected and request finished method gets called. Then goto login page again.

  3. User entering wrong username and password -- > Data again comes and request finished method gets called.

The code which I am using is:

ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setDelegate:self];
[request setTimeOutSeconds:60];

[request setUsername:User_Name];
[request setPassword:Pass_Word];
[request setValidatesSecureCertificate:NO];
[request setShouldPresentCredentialsBeforeChallenge:NO];
[request startAsynchronous];

The backend is handling stateless webservices. What is teh problem ? and what am i doing wrong ? please help me out.

Thanks, Vinod.

like image 836
Atom Avatar asked Dec 20 '25 22:12

Atom


2 Answers

You could maybe try:

[request setUseSessionPersistence:NO];
like image 200
JosephH Avatar answered Dec 23 '25 10:12

JosephH


Try with shouldPresentCredentialsBeforeChallange:YES (which is the default).

like image 41
Roger Avatar answered Dec 23 '25 11:12

Roger



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!