title: How to set a Cookie with a NSURLRequest?
body: <p>I'm trying to create a login in my iPhone App.</p>
  <pre><code>NSURL *urlNew = [NSURL URLWithString:urlstring];
  NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:urlNew];
  NSString *msgLength = [NSString stringWithFormat:@&quot;%d&quot;, [parameterString length]];
  [theRequest addValue: msgLength forHTTPHeaderField:@&quot;Content-Length&quot;];
  [theRequest setHTTPMethod:@&quot;POST&quot;];
  [theRequest setValue:length forHTTPHeaderField:@&quot;Content-Length&quot;];
  [theRequest setValue:@&quot;application/x-www-form-urlencoded&quot; forHTTPHeaderField:@&quot;Content-Type&quot;];
  [theRequest setHTTPBody: httpbody];
           
  NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self startImmediately:YES];
           
  [connection start];
  </code></pre>
  <p>That's the way how I post my data to the Server, it works - I get a response. The problem is, that the response is the code of the Login-side, not the code of the &quot;saved&quot; area. I think I have to create cookies, so that the website knows, that I am logged in.</p>
  <p>I searched on the Internet but I didn't find anything useful. So how do I create a cookie, when I am logging in? Do I have to post this cookie every time, when I am going to another link in the &quot;saved&quot; area?</p>