views:

22

answers:

2

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?

+3  A: 

You can use the static method HttpWorkerRequest.GetStatusDescription for this.

Ronald Wildenberg
A: 

If you need it at the same time you're pulling Response.StatusCode, you can get the description from Response.StatusDescription.

John Sheehan