In ASP.NET you can set the Response.StatusCode to for example 404. Should the status line / description always be set? (to in this case "404 Page Not Found")
How do you get the description if you only have the code (404)? Is this somewhere in the framework or do you manually have to hardcode the descriptions?
Just use Chrome browser. Hit F12 to get developer tools and look at the network tab. Shows you all status codes, whether page was from cache etc.
2xx successful – the request was successfully received, understood, and accepted. 3xx redirection – further action needs to be taken in order to complete the request. 4xx client error – the request contains bad syntax or cannot be fulfilled. 5xx server error – the server failed to fulfil an apparently valid request.
OK indicates that the request succeeded and that the requested information is in the response. This is the most common status code to receive.
An HTTP status code is a message a website's server sends to the browser to indicate whether or not that request can be fulfilled. Status codes specs are set by the W3C. Status codes are embedded in the HTTP header of a page to tell the browser the result of its request.
You can use the static method HttpWorkerRequest.GetStatusDescription
for this.
If you need it at the same time you're pulling Response.StatusCode, you can get the description from Response.StatusDescription.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With