views:

40

answers:

1

Hi friends,

My Requirement: I want to send login details(email, password) to server, have to maintain session for valid username.

How to create & maintain a session using "NSURLConnection" of iphone SDK?

If you found any Tutorials/Code snippets on this issue,Please post the corresponding linke here.

Advance thanks for your help.

A: 
NSString *urlString = [NSString stringWithFormat:@"http://www.mywebsite.com/[email protected]&pwd=pass"];
    NSURL *url = [NSURL URLWithString:urlString];
    NSURLRequest *request = [[NSURLRequest alloc] initWithURL: url];
    NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
    [connection release];
    [request release];
ktaylorjohn
Hi ramyauk,Even I am looking for the same a sample code perhaps.But in ur scenario , u have to understand that the session is maintained by the server and not any client (includes iphone and browsers) hence u have to use the same connection to do the request, whether ur timeout (session expired) will be communicated to u by the server. In my case, I wann to try to maintain a same connection with the server and pool and refresh it.
Ameya
I got the solution in creating new cookie, adding it to the cookie storage.

related questions