Provides extension methods for the System.Net.HttpStatusCode enumeration.
public static class HttpStatusCodeExtensions
bool IsClientError(this HttpStatusCode httpStatusCode)Summary: Determines whether the HTTP status code indicates a client error (4xx range).
Parameters:
httpStatusCode- The HTTP status code to check.Returns: if the status code is between 400-499; otherwise, .
bool IsClientOrServerError(this HttpStatusCode httpStatusCode)Summary: Determines whether the HTTP status code indicates either a client error or a server error (4xx or 5xx range).
Parameters:
httpStatusCode- The HTTP status code to check.Returns: if the status code is between 400-599; otherwise, .
bool IsInformational(this HttpStatusCode httpStatusCode)Summary: Determines whether the HTTP status code is informational (1xx range).
Parameters:
httpStatusCode- The HTTP status code to check.Returns: if the status code is between 100-199; otherwise, .
bool IsRedirect(this HttpStatusCode httpStatusCode)Summary: Determines whether the HTTP status code indicates a redirect (3xx range).
Parameters:
httpStatusCode- The HTTP status code to check.Returns: if the status code is between 300-399; otherwise, .
bool IsServerError(this HttpStatusCode httpStatusCode)Summary: Determines whether the HTTP status code indicates a server error (5xx range).
Parameters:
httpStatusCode- The HTTP status code to check.Returns: if the status code is between 500-599; otherwise, .
bool IsSuccessful(this HttpStatusCode httpStatusCode)Summary: Determines whether the HTTP status code indicates success (2xx range).
Parameters:
httpStatusCode- The HTTP status code to check.Returns: if the status code is between 200-299; otherwise, .
string ToNormalizedString(this HttpStatusCode httpStatusCode)Summary: Converts the HTTP status code to a normalized string representation.
Parameters:
httpStatusCode- The HTTP status code to convert.Returns: A normalized string representation of the HTTP status code (e.g., "Ok" instead of "OK").
string ToStatusCodesConstant(this HttpStatusCode httpStatusCode)Summary: Converts the HTTP status code to a status codes constant name format.
Parameters:
httpStatusCode- The HTTP status code to convert.Returns: A string in the format "Status{code}{name}" (e.g., "Status200OK").