0
votes

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
why using ASIHTTP? move to AFNetworking or some other library which is being maintainedamar
ASIHttpRequest has know issues with iOS 7 and 8, also the developers stopped maintaining it for some time now. I suggest you move to AFNetworking it rater simple to replace any ASIHttpRequest.rckoenes
@rckoenes Now I'm using AFNetworkin. Can you please check this question. stackoverflow.com/questions/27101762/…CAN

1 Answers

0
votes

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.