title: Caching Asp .Net Web Api
body: <p>I am trying to catch an method in the api that I am implementing. I have created an attribute that is based in this article(<a href="http://www.codeproject.com/Articles/682296/Setting-Cache-Control-HTTP-Headers-in-Web-API-Cont" rel="nofollow noreferrer">http://www.codeproject.com/Articles/682296/Setting-Cache-Control-HTTP-Headers-in-Web-API-Cont</a>).</p>
  
  <pre><code>[Route("")]
  [CacheControl(MaxAge = 160)]
  public IEnumerable&lt;Club&gt; GetAll()
  {
      return _clubService.GetAll();
  }
  </code></pre>
  
  <p>The code of this attribute is:</p>
  
  <pre><code>public class CacheControlAttribute : ActionFilterAttribute
  {
      public int MaxAge { get; set; }
  
      public CacheControlAttribute()
      {
          MaxAge = 160;
      }
  
      public override void OnActionExecuted(HttpActionExecutedContext context)
      {
          context.Response.Headers.CacheControl = new CacheControlHeaderValue
          {
              Public = true,
              MaxAge = TimeSpan.FromSeconds(MaxAge)
          }; 
  
          base.OnActionExecuted(context);
      }
  }
  </code></pre>
  
  <p>I am calling directly this method from chrome. But the server is always executing the query and I canot get the server to return Not Modified. I am doing something wrong?</p>
  
  <p>---------------------------------------------------------------EDIT--------------------------------------------------------------
  These are the header of my call:</p>
  
  <p><img src="https://i.stack.imgur.com/2CMjd.png" alt="enter image description here"></p>