ServerCertificateValidationCallback ignored

I have the following code that throws a WebException, and I cannot understand why life is for me. VS2012 / .Net 4.5 RTM for Windows 8 RTM.

ServicePointManager.CertificatePolicy = null; ServicePointManager.CheckCertificateRevocationList = false; ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; var request = WebRequest.Create(url) as HttpWebRequest; request.ServerCertificateValidationCallback = delegate { return true; }; var response = request.GetResponse(); WebException was unhandled The request was aborted: Could not create SSL/TLS secure channel. 

I initially had a callback as its own method, which was never called. Any ideas why I cannot ignore SSL validation errors and send all my sensitive data to an unknown web server?

+4
source share
1 answer

Microsoft will not allow this. This is detrimental to the platform because it is for this reason that we are developing applications for this. (we have millions of happy customers)

http://social.msdn.microsoft.com/Forums/windowsapps/en-US/f5821194-4c40-48e7-976c-3dec8864ac59/servicepointmanagerservercertificatevalidationcallback?forum=winappswithcsharp

You need a valid certificate or a real workaround. This is a big flaw for security reasons.

+1
source

Source: https://habr.com/ru/post/1439605/


All Articles