Other 4xx codes
All HTTP status codes in ASP.NET Core
4xx Client error
The Range the client asked for is outside the resource. The response carries Content-Range: bytes */length.
In ASP.NET Core: Static files and range-enabled file results handle it.
The StatusCodes constant, HttpStatusCode enum name, reason phrase, class, and how EnsureSuccessStatusCode() and the standard resilience handler treat 416.
| Constant | StatusCodes.Status416RequestedRangeNotSatisfiable, StatusCodes.Status416RangeNotSatisfiable |
|---|---|
| HttpStatusCode | HttpStatusCode.RequestedRangeNotSatisfiable |
| Reason phrase | Kestrel sends Range Not Satisfiable; HttpClient's ReasonPhrase is Requested Range Not Satisfiable |
| Class | 4xx, client error |
| IsSuccessStatusCode | false |
| EnsureSuccessStatusCode() | throws HttpRequestException: Response status code does not indicate success: 416 (Requested Range Not Satisfiable). |
| Standard resilience handler | does not retry it |
Results.StatusCode(StatusCodes.Status416RequestedRangeNotSatisfiable)
Results.Problem(statusCode: StatusCodes.Status416RequestedRangeNotSatisfiable, detail: "...")StatusCode(StatusCodes.Status416RequestedRangeNotSatisfiable)
Problem(statusCode: StatusCodes.Status416RequestedRangeNotSatisfiable, detail: "...")What Results.Problem(statusCode: 416) sends (with AddProblemDetails()), as application/problem+json:
{
"type": "https://tools.ietf.org/html/rfc9110#section-15.5.17",
"title": "Range Not Satisfiable",
"status": 416,
"traceId": "0HNA1B2C3D4E5:00000001"
}A controller's Problem(statusCode: 416) sends the same body.
A bare StatusCode(416) in an [ApiController] also gets a ProblemDetails body automatically; Results.StatusCode(416) in a minimal API sends an empty body unless you add UseStatusCodePages().
Setup
app.UseStaticFiles();Request
GET /file.txt HTTP/1.1
Range: bytes=5000-6000
(the file has 1,000 bytes)Response (recorded)
HTTP/1.1 416 Range Not Satisfiable
Content-Range: bytes */1000The range cannot be served, so the response is 416 with Content-Range: bytes */1000 telling the client the real length.
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