title: Best way to save cookie in C# .NET?
body: <p>Sometimes, you may need to call a 'login' url, passing in some sort of username/password. The web service will then usually return a cookie that you may use in subsequent requests.</p>
  
  <p>In the following code(C# .NET), what is the correct way to save this cookie? </p>
  
  <pre><code>cookies = new CookieContainer();
  HttpWebResponse response = (HttpWebResponse)req.GetResponse();
  if (response.StatusCode == HttpStatusCode.OK)
  {
       cookies = req.CookieContainer;   //*choice 1*
       cookies.Add(req.CookieContainer.GetCookies(uri));  //*choice 2*
       cookies.Add(response.Cookies);  //*choice 3*
  }
  </code></pre>
  
  <p>With choice 1, there doesn't seem to be a way to 'append' the returned CookieContainer to an existing CookieContainer (if I am saving other cookies).</p>