Closed nickelnext closed 3 years ago
Hi @nickelnext ,
I wonder how the httpClient
that you're passing in the first example is configured, maybe there's a problem there.
If you pass WebDavClientParams
the WebDavClient
creates & configures HttpClient
instance internally.
Here's a code: https://github.com/skazantsev/WebDavClient/blob/master/src/WebDav.Client/WebDavClient.cs#L783
I recommend to play with settings of HttpClientHandler
of the HttpClient
that you're passing.
When using WebDavClientParams
the following properties are to true
by default: PreAuthenticate
, UseDefaultCredentials
and these settings are probably false
for a new instance of HttpClient
.
Hope that helps.
I'll check it.
Thanks for your prompt response!
Hi
Same user:pass:
If I use
WebDavClient result = new WebDavClient(httpClient);
, when making PROPFIND i get 401 unauthorized (sometimes the first time, sometimes the second time)If i use
WebDavClientParams clientParams = new WebDavClientParams { BaseAddress = new Uri(serviceUrl), Credentials = new NetworkCredential(username, password) }; webDavClient = new WebDavClient(clientParams);
Propfind works like a charme.
Note:
httpclient
has thesameBaseAddress
specified inBaseAddress
ofWebDavClientParams
, and the credentials are the sameNote2: the propfind is made on a folder (not the root folder). I didn't test it on a file