title: Cookie created in WebAPI response is never sent in subsequent client requests. Seeking example with round trip Server->Client->Server
body: <p>I am using ASP.Net Core 2 WepAPI controller.<br>
  Current version of Chrome(currently 64).<br>
  Angular 5 SPA.<br>
  Need to work on localhost.</p>
  
  <p>This is controller method:</p>
  
  <pre><code>public class TestController : ControllerBase
  {
      [HttpGet, Route("api/[controller]/test")]
      public async Task&lt;IActionResult&gt; Get()
      {
          Response.Cookies.Append("testcookie", "testvalue", new CookieOptions
          {
              Path = "/",
              Domain = "localhost",
              Expires = DateTime.UtcNow.AddHours(6),
              HttpOnly = false,
              Secure = false
          });
  
          return Ok("Test Ok.");
      }
  }
  </code></pre>
  
  <p>And I don't think it matters, but this is my client code.</p>
  
  <pre><code>  private async test2() {
      const res = await this.http.get('http://localhost:59879/api/test/test').toPromise();
    }
  </code></pre>
  
  <p>When I look in Chrome Console -> Network Tab -> the request line -> Cookies Tab; I see my response cookie(s) but no request cookie.  I also do not see request cookie in <code>HttpContext.Request.Cookies</code> on subsequent requests.</p>
  
  <p>How do I create <em>any kind of cookie</em>, </p>
  
  <ul>
  <li>that is created server side, and returned from controller method, </li>
  <li>and client/browser sends to server?</li>
  </ul>
  
  <p>Assume server is on localhost:59879.</p>
  
  <p>I have tried many iterations of setting the <code>Domain</code> to localhost, 127.0.0.1, false and excluding it.  Tried not specifying <code>CookieOptions</code> at all, no <code>Expires</code>, and various combinations of <code>HttpOnly</code> and <code>Secure</code> settings to no avail. </p>
  
  <p>These are some resources I have tried.</p>
  
  <ul>
  <li><a href="https://docs.microsoft.com/en-us/aspnet/web-api/overview/advanced/http-cookies#cookies-in-web-api" rel="nofollow noreferrer">HTTP Cookies in ASP.NET Web API</a></li>
  <li><a href="https://stackoverflow.com/questions/1134290/cookies-on-localhost-with-explicit-domain">Cookies on localhost with explicit domain</a></li>
  <li><a href="https://stackoverflow.com/questions/7346919/chrome-localhost-cookie-not-being-set?noredirect=1&amp;lq=1">Chrome localhost cookie not being set</a></li>
  <li>Googled the following:  "net core 2 cookie -authentication"</li>
  </ul>
  
  <p><strong>Update</strong> - I see a recent <a href="https://stackoverflow.com/questions/49392275/angular-5-cookie-is-set-although-set-cookie-is-in-the-response-header">SO</a> that <em>may</em> have the same cause of what I am experiencing.</p>