I'm trying to intercept the validation of the returned server certificates in a .net framework application. I came with two solutions:
Use
HttpClientHandler.ServerCertificateValidationCallback = (httpRequestMessage, cert, cetChain, policyErrors) =>{ my implementation}
Use
ServicePointManager.ServerCertificateValidationCallback = (httpRequestMessage, cert, cetChain, policyErrors) =>{ my implementation}
Is there advantage for the use of one on another?
From the article it says
We don't recommend that you use the ServicePointManager class for new development. Instead, use the System.Net.Http.HttpClient class.
Is there any reason for that , other than ServicePointManager not being used in .net Core?