title: How to get cookies from HttpActionContext on AuthorizeAttribute custom class?
body: <p>I am validating a token stored on cookies, so I created a class</p>
  
  <pre><code>public class VIEWAuthorizeAttribute : AuthorizeAttribute
  </code></pre>
  
  <p>then I overrode the OnAuthorization class</p>
  
  <pre><code>public override void OnAuthorization(AuthorizationContext filterContext)
  {
     var cookie = filterContext.HttpContext.Request.Cookies.Get("Profile"); //This is working
  
     if (cookie != null &amp;&amp; IsValidToken(cookie["Token"]))
     {
         return;
     }
  
     HandleUnauthorizedRequest(filterContext);
  }
  </code></pre>
  
  <p>That works fine for MVC Controllers, but when I try to do something similar for web api controller, I am not able to get the cookies from the request.</p>
  
  <pre><code>public override void OnAuthorization(HttpActionContext actionContext)
  {
      var foo = actionContext.Request.Headers.Cookies; //that is not working
      if (Authorize(actionContext))
      {
          return;
      }
      HandleUnauthorizedRequest(actionContext);
  }
  </code></pre>
  
  <p><code>actionContext.Request.Headers</code> does not have a method <code>Cookies</code>, I also tried with <code>actionContext.Request.Headers.GetCookies("Bar")</code> like this <a href="https://stackoverflow.com/a/38455135/1762393">answer</a>, but Header does not have that <code>GetCookies</code> method.</p>
  
  <p>Any idea?</p>