Other 4xx codes
All HTTP status codes in ASP.NET Core
4xx Client error
Not a standard code. nginx logs it when the client disconnects before the response; it is never sent to the client.
In ASP.NET Core: StatusCodes has a constant for it, useful for logging cancelled requests (HttpContext.RequestAborted).
The StatusCodes constant, HttpStatusCode enum name, reason phrase, class, and how EnsureSuccessStatusCode() and the standard resilience handler treat 499.
| Constant | StatusCodes.Status499ClientClosedRequest |
|---|---|
| HttpStatusCode | none; use (HttpStatusCode)499 |
| Reason phrase | Kestrel sends Client Closed Request; HttpClient's ReasonPhrase is null |
| Class | 4xx, client error |
| IsSuccessStatusCode | false |
| EnsureSuccessStatusCode() | throws HttpRequestException: Response status code does not indicate success: 499. |
| Standard resilience handler | does not retry it |
Results.StatusCode(StatusCodes.Status499ClientClosedRequest)
Results.Problem(statusCode: StatusCodes.Status499ClientClosedRequest, detail: "...")StatusCode(StatusCodes.Status499ClientClosedRequest)
Problem(statusCode: StatusCodes.Status499ClientClosedRequest, detail: "...")What Results.Problem(statusCode: 499) sends (with AddProblemDetails()), as application/problem+json:
{
"title": "Client Closed Request",
"status": 499,
"traceId": "0HNA1B2C3D4E5:00000001"
}A controller's Problem(statusCode: 499) sends a different body, because MVC only fills type and title for codes in ApiBehaviorOptions.ClientErrorMapping:
{
"status": 499,
"traceId": "0HNA1B2C3D4E5:00000001"
}A bare StatusCode(499) in an [ApiController] also gets a ProblemDetails body automatically; Results.StatusCode(499) in a minimal API sends an empty body unless you add UseStatusCodePages().
Every response on this page was recorded from ASP.NET Core 10.0.12 on Kestrel in the Production environment; the HttpClient rows come from .NET 10.0.12 and Microsoft.Extensions.Http.Resilience 10.10.0.
All HTTP status codes in ASP.NET Core