"Request aborted: failed to create SSL/TLS Secure Channel" solution, ssltls
1. Install the certificate:
Manual double-click certificate Installation
2. Assign permissions:
Find the Installed Certificate on the console, right-click it, and choose manage private key ",
Add the required permissions. If you want to test, you can directly add Everyone.
3. modify the code: public static string Refund (string urlWithParams)
{ServicePointManager. expect100Continue = true; ServicePointManager. securityProtocol = SecurityProtocolType. tls; // select the Protocol as needed. If not, try ServicePointManager again. response = (object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) ==>{ return true ;}; HttpWebRequest webRequest = (HttpWebRequest) HttpWebRequest. create (urlWithParams); webRequest. method = "GET"; // find the imported certificate X509Store certStore = new X509Store (StoreName. my, StoreLocation. localMachine); certStore. open (OpenFlags. readOnly); X509Certificate2Collection certCollection = certStore. certificates. find (X509FindType. findBySubjectName, "Certificate Name installed", false); webRequest. clientCertificates. add (certCollection [0]); using (WebResponse webResponse = webRequest. getResponse () {var sr = new StreamReader (webResponse. getResponseStream (), Encoding. UTF8); var responseData = sr. readToEnd ();
Return responseData ;}}