WebDAV开发感悟

最近一段时间,资安问题被推到风头浪尖上。为了能让回避使用不安全方式传输文件,研究并开发了一个小工具,用WebDav协议进行文件传输。WebDav具有http协议的一些扩展命令,同时,它也支持IIS的身份验证和https加密传输协议,应用广泛。在开发中遇到一些问题,记录如下:

1. MKCOL命令用于创建子目录. 但是不能在创建已存在的目录,否则会出现405错误。请参考:http://msdn.microsoft.com/en-us/library/aa142923(v=exchg.65).aspx

2. 如果采用NTLM进行身份验证后,在向服务器上传文件的时候,应该将AllowWriteStreamBuffering项设置成true. 如:webRequest.AllowWriteStreamBufferring = true. 否则会出现"This request requires buffering data to succeed"错误。在这个网站上说,虽然NTLM不支持buffer,但缺省将此项设置成true是最好的。http://www.webdavsystem.com/client/programming/upload

To avoid in-memory buffering when uploading files set this property to false. Servers with Basic, Digest, Kerberos and Anonymous authentication support unbuffered uploads while NTLM authentication by default - not.

To allow unbuffered uploads for NTLM you will have to tune your server settings. You will have to set authentication for first request only on server side, otherwise you will get a "This request requires buffering data to succeed" exception.

另外,我在网上也找到一个同步软件,现在是免费的,试用了一下,感觉非常不错。

http://alwaysync.com/

原文地址:https://www.cnblogs.com/sdikerdong/p/2367973.html