title: HttpClient does not see "Set-Cookie" header
body: <p>I have an MVC login form:</p>
  
  <pre><code>[HttpPost]
      public ActionResult Login(LoginViewModel viewModel)
      {
          if (viewModel.Username == "alex" &amp;&amp; viewModel.Password == "password")
          {
              FormsAuthentication.SetAuthCookie(viewModel.Username, false);
              return RedirectToAction("Index", "Home");
          }
  
          return View();
      }
  </code></pre>
  
  <p>And Console app client that consumes MVC Login action:</p>
  
  <pre><code>private static void GetPerson()
      {
          Console.WriteLine("Username:");
          string username = Console.ReadLine();
  
          Console.WriteLine("Password:");
          string password = Console.ReadLine();
  
          using (HttpClient httpClient = new HttpClient())
          {
              HttpRequestMessage authRequest = new HttpRequestMessage();
              authRequest.Method = HttpMethod.Post;
              authRequest.RequestUri = new Uri(@"http://localhost:4391/Account/Login");
              authRequest.Content = new FormUrlEncodedContent(new List&lt;KeyValuePair&lt;string, string&gt;&gt;
              {
                  new KeyValuePair&lt;string, string&gt;("Username", username),
                  new KeyValuePair&lt;string, string&gt;("Password", password)
              });
  
              HttpResponseMessage authResponse = httpClient.SendAsync(authRequest).Result;
              IEnumerable&lt;string&gt; cookieValues;
              authResponse.Headers.TryGetValues("Set-Cookie", out cookieValues);
  
          }
      }
  </code></pre>
  
  <p>Problem: authResponse.Headers.TryGetValues("Set-Cookie", out cookieValues) is not finding "Set-Cookie" header so cookieValues comes out to be "null".</p>
  
  <p>I ran Fiddler for Login action in MVC and here is what I got back:</p>
  
  <pre><code>HTTP/1.1 302 Found
  Cache-Control: private
  Content-Type: text/html; charset=utf-8
  Location: /
  Server: Microsoft-IIS/8.0
  X-AspNetMvc-Version: 5.1
  X-AspNet-Version: 4.0.30319
  Set-Cookie:   .ASPXAUTH=A6A22208AECA1F3E25B43C834BE058A5019F3A9C55AED099FFAD5B0FE7B289EC2C3F87C157B0C1ED338D1DF0A6469E6C5DE8D9DB7A99D54D992EA10F26424BA579C262B7CD247CA4193879E058A233B7A0BC98E10503440B79EB988239C43696; path=/; HttpOnly
  X-SourceFiles: =?UTF-8?B?YzpcdXNlcnNcYWxleGFuZGVyXGRvY3VtZW50c1x2aXN1YWwgc3R1ZGlvIDIwMTNcUHJvamVjdHNcRm9ybVZhbHVlc0F1dGhXZWJBUElcRm9ybVZhbHVlc0F1dGhXZWJBUElcQWNjb3VudFxMb2dpbg==?=
  X-Powered-By: ASP.NET
  Date: Sat, 19 Apr 2014 20:09:23 GMT
  Content-Length: 428
  </code></pre>
  
  <p>Fiddler shows that I'm getting "Set-Cookie" back but why HttpClient does not see it?</p>