saguiitay / WebDAVClient

Strongly-typed, async WebDAV Client implementation in C#
Other
120 stars 55 forks source link

ServerCertificateValidationCallback #33

Open giviglie opened 6 years ago

giviglie commented 6 years ago

Not clear how to use it. Always getting a TLS error message and callbeck is never called.

Thanks

pYThMik commented 6 years ago

Indeed, the usage is not detailed here. You can refer to https://docs.microsoft.com/en-us/dotnet/api/system.net.security.remotecertificatevalidationcallback?redirectedfrom=MSDN&view=netframework-4.7.2

However, I'm trying to access a synology NAS through WebDAV and like @giviglie , the callback seems to never be called. I just added a "return true;" in the callback but the client continues to say that the certificate can't be validated.

saguiitay commented 3 years ago

Did you make sure to register your callback:

ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(ValidateCertificate);

Which version of .Net are you using? .Net Framework 4.x? .Net Core 2.x? .Net Core 3.x