View on GitHub

WebDAV#

WebDAV server in C#

Status codes

For the status codes of Http, the WebDAV# server makes use of the HttpStatusCode enumeration, which is included in the .NET Framework 4.5, in the System.Net namespace.

The WebDav status codes are defined as an enum in the WebDAV# server, because the HttpStatusCode enumeration is missing the status codes 207 Multi-Status, 422 Unprocessable Entity, 423 Locked, 424 Failed Dependency, 507 Insufficient Storage.

To get the description of these HTTP and WebDAV status codes, the server uses the following method: HttpWorkerRequest.GetStatusDescription of the System.Web namespace.

The following example shows how the status code “Multi-Status” is added to the response of a WebDAV method.

context.Response.StatusCode = (int)WebDavStatusCode.MultiStatus;
context.Response.StatusDescription =
    HttpWorkerRequest.GetStatusDescription((int)WebDavStatusCode.MultiStatus);