In previous versions of ASP.Net, we could retrieve the description of a HTTP status code in a few ways as shown here:
Get description for HTTP status code
Is the
You can use Microsoft.AspNetCore.WebUtilities.ReasonPhrases.GetReasonPhrase(int statusCode) (which can be got from the Microsoft.AspNetCore.WebUtilities package in NuGet if not already referenced in your project transiently by a package like Microsoft.AspNetCore.App
):
using Microsoft.AspNetCore.WebUtilities;
int statusCode = 404;
string reasonPhrase = ReasonPhrases.GetReasonPhrase(statusCode);