title: ActionFilter Response.StatusCode is always 200
body: <p>I'm trying to setup an action filter that only does something if the <code>StatusCode</code> of the <code>HttpContext.Response</code> is 302.</p>
  
  <p>I would expect to be able to do this in the <code>OnActionExecuting</code> method, but the <code>StatusCode</code> is always <code>200</code>.</p>
  
  <p><code>ActionFilter</code> code:</p>
  
  <pre><code>public class CustomFilter : IActionFilter
  {
     public void OnActionExecuting(ActionExecutingContext context)
      {
          // do some setup
      }
  
      public void OnActionExecuted(ActionExecutedContext context)
      {
          if (context.HttpContext.Response.StatusCode == StatusCodes.Status302Found)
          {
              // never get here
          }
      }
  }
  </code></pre>
  
  <p>My <code>Action</code> method:</p>
  
  <pre><code>public IActionResult Redirect()
  {
      return RedirectToAction("Index", "Home");
  }
  </code></pre>
  
  <p>And registering the <code>ActionFilter</code> in <code>startup</code>:</p>
  
  <pre><code>public void ConfigureServices(
      IServiceCollection services)
  {
      services.AddMvc(
          options =&gt;
          {
              options.Filters.Add(new CustomFilter());
          });
  }
  </code></pre>
  
  <p>I have checked in the browser and it is correctly returning 302 and doing the redirect. I have also tried using the <code>IAsyncActionFilter</code> interface but had the same problem.</p>
  
  <p>How can I apply my <code>ActionFilter</code> to (<em>only</em>) a redirected response?</p>
  
  <p>And why is this not working as is?</p>
  
  <p><strong>EDIT</strong>: Whoops I had them the wrong way round. Actually I am still getting this issue though...</p>