title: .NET Core 2.0 Web Api - cookies
body: <p>I am using .NET Core 2.0 Web Api and I am trying to set some values to cookies and later get those values. Here is the method for creating new cookie: (solution taken straight from <a href="https://www.c-sharpcorner.com/article/asp-net-core-working-with-cookie/" rel="nofollow noreferrer">https://www.c-sharpcorner.com/article/asp-net-core-working-with-cookie/</a>)</p>
  
  <pre><code>protected void SetCookie(string key, string value, int expireTime = 30)
  {
      var option = new CookieOptions
      {
          Expires = DateTime.Now.AddMinutes(expireTime)
      };
  
      Response.Cookies.Append(key, value, option);
  }
  </code></pre>
  
  <p>Here is the method for getting cookie value:</p>
  
  <pre><code>string GetCookie(string key)
  {
      return Request.Cookies[key];
  }
  </code></pre>
  
  <p>Request.Cookies is always empty (has 0 elements). Could you tell me what I am doing wrong?</p>
  
  <p>Additional informations: On the front-end side I am using Angular 5 (front-end app sits on <a href="http://localhost:4200/" rel="nofollow noreferrer">http://localhost:4200/</a> and back-end app sits on <a href="http://localhost:5000/" rel="nofollow noreferrer">http://localhost:5000/</a>). But for now I want to save cookie and get cookie just on the backend side.</p>