PreconditionFailedException Class

IT Hit WebDAV for .NET

Precondition failed.

For a list of all members of this type, see PreconditionFailedException Members.

System.Object
   System.Exception
      ITHit.WebDAV.Client.Exceptions.WebDavException
         ITHit.WebDAV.Client.Exceptions.WebDavHttpException
            ITHit.WebDAV.Client.Exceptions.PreconditionFailedException

[Visual Basic]
NotInheritable Public Class PreconditionFailedException
    Inherits WebDavHttpException
[C#]
public sealed class PreconditionFailedException : WebDavHttpException

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

Thrown when server responded with 412 (Precondition Failed) http response. The precondition given in one or more of the request-header fields evaluated to false when it was tested on the server. This response code allows the client to place preconditions on the current resource metainformation (header field data) and thus prevent the requested method from being applied to a resource other than the one intended.

Example

IFolder itemSrc = session.OpenFolder(new Uri("http://server:8080/Library/"));
IFolder itemDst = session.OpenFolder(new Uri("http://server:8080/Sales/"));
try
{
    itemSrc.MoveTo(itemDst, itemSrc.DisplayName, false);
}
catch (PreconditionFailedException)
{
    Console.WriteLine("The destination item exists and 'overwrite' was 'false'.");
}
catch (WebDavHttpException ex)
{
    Console.WriteLine(ex.Message + " " + ex.Status.Code + " " + ex.Status.Description);
    foreach (IMultistatusResponse resp in ex.Multistatus.Responses)
    { // Find which items failed to move.
        Console.WriteLine(resp.Href + " " + resp.Status.Code + " " + resp.Status.Description);
    }
}

Requirements

Namespace: ITHit.WebDAV.Client.Exceptions

Assembly: ITHit.WebDAV.Client (in ITHit.WebDAV.Client.dll)

See Also

PreconditionFailedException Members | ITHit.WebDAV.Client.Exceptions Namespace