System.Web.HttpResponse.StatusCode Property

Gets or sets the HTTP status code of the output returned to the client.

Syntax

public int StatusCode { set; get; }

Value

The current status code. Defaults to 200.

Remarks

This property controls the HTTP status code that is sent back to the HTTP client.

If the setter method is called after the headers have been set, an System.Web.HttpException will be thrown.

The following is a list of the RFC defined status codes:

HTTP Status CodeStatus Description
100Continue
101Switching Protocols
200OK
201Created
202Accepted
203Non-Authoritative Information
204No Content
205Reset Content
206Partial Content
300Multiple Choices
301Moved Permanently
302Found
303See Other
304Not Modified
305Use Proxy
307Temporary Redirect
400Bad Request
401Unauthorized
402Payment Required
403Forbidden
404Not Found
405Method Not Allowed
406Not Acceptable
407Proxy Authentication Required
408Request Time-out
409Conflict
410Gone
411Length Required
412Precondition Failed
413Request Entity Too Large
414Request-URI Too Large
415Unsupported Media Type
416Requested range not satisfiable
417Expectation Failed
500Internal Server Error
501Not Implemented
502Bad Gateway
503Service Unavailable
504Gateway Time-out
505HTTP Version not supported

Requirements

Namespace: System.Web
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0