ASIHTTPRequest vs NSHTTPCookie Cookie response issue

207 views Asked by At

I'm trying to get a cookie from the server so with username and password and cookie I can login to the server.

In ASIHTTPRequest I get the cookie as

JSESSIONID=Pt1vcPv0TbaRsK2J6nnWuHu4.pard; Path=/parity,JSESSIONID=z9Gf40eSCVsF3xYcG-yrONsU.pardemo; Path=/parity,NSC_QBSJUFN-EFNP=ffffffff090b1dd445525d5f4f58455e445a4a4229a0;path=/

While in NSHTTPCookie I get it very different this is how I call the cookie. Is there a way so I can get it as the result above?

NSMutableURLRequest *postRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://www.exapmle.com/server/api.ashx"]];

NSArray *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies];
NSHTTPCookie *cookie =[[NSHTTPCookie alloc]init];
for (int i = 0; i < [cookies count]; i++) {

    cookie = [cookies objectAtIndex:i];

    NSLog(@"Cookie: %@, %@, %@ ,%@", [cookie domain],[cookie path],[cookie name],[cookie value]);

    }
}
1

There are 1 answers

1
amar On BEST ANSWER

ASIHttp is quite old and is no more being used even its developer suggest you should stop using it Link

Move to AFNetworking a nice library by good people.