title: WebApi returning wrong status code
body: <p>I have an operation handler that checks for authentication and throws an exception when authentication fails using</p>
  
  <pre><code>throw new WebFaultException(HttpStatusCode.Unauthorized); 
  </code></pre>
  
  <p>However this still returns a 404 Not Found status code to the client/test client. </p>
  
  <p>This is my operation handler</p>
  
  <pre><code>public class AuthOperationHandler : HttpOperationHandler&lt;HttpRequestMessage, HttpRequestMessage&gt;
  {
      RequireAuthorizationAttribute _authorizeAttribute;
  
      public AuthOperationHandler(RequireAuthorizationAttribute authorizeAttribute) : base("response")
      {
          _authorizeAttribute = authorizeAttribute;
      }
  
      protected override HttpRequestMessage OnHandle(HttpRequestMessage input)
      {
          IPrincipal user = Thread.CurrentPrincipal;
  
          if (!user.Identity.IsAuthenticated)
              throw new WebFaultException(HttpStatusCode.Unauthorized);
  
          if (_authorizeAttribute.Roles == null)
              return input;
  
          var roles = _authorizeAttribute.Roles.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries);
  
          if (roles.Any(role =&gt; user.IsInRole(role)))
              return input;
  
          throw new WebFaultException(HttpStatusCode.Unauthorized);
      }
  }
  </code></pre>
  
  <p>Am I doing something wrong?</p>