Uploading a file to WebDAV server using WebClient.UploadFile returns 401
Solution 1:
WebClient
is an HTTP Client, not a WebDAV client.
If you do WebClient.UploadFile
, it by default uses HTTP POST
request, not WebDAV PUT
request.
The authentication failure can be just a side effect of that. And even if not, and you solve the authentication problem, it would probably not help you.
I do not know if it can help, but try using an overload that takes method
argument and use "PUT"
.
Another option, as WinSCP works for you, is using WinSCP .NET assembly.