0

How can I generate a http substatus code in C#, an error occured like 500.13? The below code does not work. It show error 500 page not error 500.13 page

Response.StatusCode = 500;
Response.SubStatusCode = 13;
Response.End();

Also this is the web.config

<system.webServer>
   <httpErrors errorMode="Custom" existingResponse="Replace" defaultResponseMode="File">

2 Answers 2

3

Is there such a thing as a "500.13" page? The documentation for SubStatusCode says

Independent of whether tracing is configured, the code is never sent as part of the final response to the request.

It looks like substatus codes only ever appear in server logs. Have you checked those?

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

Comments

-1

If you are looking into sending a sub-status code to the client, then you would have to set a header as in:

Response.AddHeader("X-Substatus", 13);

Obviously, it won't appear as 500.13 anywhere but in messages you generate.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.