title: Incorrect HttpStatus code on ASP.NET Core
body: <p>I have a Exception middleware on ASP.NET Core application that do this:</p>
  
  <pre><code>try
  {
      await _next(httpContext);
  }
  catch (MyException exception)
  {
      httpContext.Response.ContentType = "application/json";
      httpContext.Response.StatusCode = (int)HttpStatusCode.Forbidden;
  
      await httpContext.Response.WriteAsync(exception.Message);
  }
  </code></pre>
  
  <p>On this example, we send "Forbidden" (403 http status code) but <strong>I always receive 500</strong>. I inspect this on Swagger and Google Chrome and I don't understand the reason.</p>