1

In .net core webapi, is there option to introduce HTTP status code with decimals example 401.2, 401.3 etc., like how it is been done in IIS?

Is it better practice to have HTTP status code with decimals? if it is not, why it is been introduced in IIS?

HTTP sub-status codes

1 Answer 1

4

Does HTTP status code can have decimal values?

The most recent HTTP specification (RFC 9110) says

The status code of a response is a three-digit integer code.... All valid status codes are within the range of 100 to 599, inclusive.

So, no - a status code with a decimal value is not valid.

The constraint that status codes be integers dates back to RFC 1945 (1996)


why it is been introduced in IIS?

As discussed in an earlier question:

IIS defines substatuses to help differentiate cases within the same defined status code for debugging purposes. These aren't sent on the wire in the HTTP response; as others have noted, that's an integer. They may appear in the response entity if configured (by default, only for clients running on the same host), and they're logged in the W3C log under the "sc-substatus" column. -- Mike Bishop, 2016-08-09

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.