title: Why is the Response set in ExceptionFilter ignored?
body: <p>I have the following exception filter:</p>
  
  <pre><code>public class ArgumentExceptionFilterAttribute : ExceptionFilterAttribute
  {
      public override void OnException(HttpActionExecutedContext actionExecutedContext)
      {
          var exception = actionExecutedContext.Exception as ArgumentException;
  
          if (exception != null)
              actionExecutedContext.Response = actionExecutedContext.Request.CreateResponse(HttpStatusCode.BadRequest, new
              {
                  FailureReason = exception.Message
              });
  
          base.OnException(actionExecutedContext);
      }
  }
  </code></pre>
  
  <p>I then call the following action with a  null 'id':</p>
  
  <pre><code>    public object Get(string id)
      {
          if (string.IsNullOrEmpty(id))
              throw new ArgumentNullException(nameof(id));
  
          return Client.getProfileForUser(ExternalAuthToken, id);
      }
  </code></pre>
  
  <p>I set a break point in the ExceptionFilter and while stepping through the code I can confirm it does set the Response correctly.</p>
  
  <p>My logging action filter shows the response has been set correctly but the browser receives a Server 500 error with full exception details in HTML format.</p>
  
  <p>I've tried:</p>
  
  <ul>
  <li>Setting customErrors to 'Off' and this had no effect.</li>
  <li>I've added Message Handler and checked that the response is correct at the Message Handler level. It is correct at this level.</li>
  </ul>
  
  <p>Why is the response set in the filter being overridden, and by where in the pipeline would this be happening?</p>
  
  <h2>Edit (Now Resolved)</h2>
  
  <p>I have resolved this issue by deleting the "bin" folder and rebuilding. I am not sure how this could have fixed it however.</p>