Namespace: ITHit.WebDAV.Client
Exception | Condition |
---|---|
NotFoundException | This resource doesn't exist on the server. |
ConflictException | The resource is version controlled and has to be checked out to be edited. |
WebDavHttpException | Server returned unknown error. |
WebDavException | Unexpected error occurred. |
string license = "<?xml version='1.0' encoding='utf... WebDavSessionAsync session = new WebDavSessionAsync(license); session.Credentials = new NetworkCredential("User1", "pwd"); IFolderAsync folder = session.OpenFolder(new Uri("http://server:8080/Sales")); FileInfo file = new FileInfo("C:\\Products.exe"); IFileAsync file = folder.CreateResource(file.Name); using (Stream webStream = file.GetWriteStream(file.Length)) { int bufSize = 1048576; // 1Mb byte[] buffer = new byte[bufSize]; int bytesRead = 0; using (FileStream fileStream = file.Open(FileMode.Open, FileAccess.Read, FileShare.Read)) { while ((bytesRead = fileStream.Read(buffer, 0, bufSize)) > 0) webStream.Write(buffer, 0, bytesRead); } }