1. Install the certificate:
Manually double-click the certificate to install the process slightly
2. Assigning Permissions:
Locate the installed certificate in the console, right-select Manage private key,
Add the permissions you need if you can add everyone directly in the test
3. Modify code: public static string Refund (string urlwithparams)
{servicepointmanager.expect100continue=true; Servicepointmanager.securityprotocol= Securityprotocoltype.tls;//protocol on Demand, no, just try it all over again.Servicepointmanager.servercertificatevalidationcallback = (ObjectSender, X509Certificate certificate, X509chain chain, sslpolicyerrors sslpolicyerrors) = {return true; }; HttpWebRequest WebRequest=(HttpWebRequest) httpwebrequest.create (urlwithparams); Webrequest.method="GET"; //Find the certificate we importedX509store Certstore =NewX509store (storename.my, storelocation.localmachine); Certstore.open (openflags.readonly); X509Certificate2Collection certcollection= CertStore.Certificates.Find (x509findtype.findbysubjectname, "Installed certificate name",false); WEBREQUEST.CLIENTCERTIFICATES.ADD (certcollection[0]); using(WebResponse WebResponse =Webrequest.getresponse ()) { varSR =NewStreamReader (WebResponse.GetResponseStream (), Encoding.UTF8); varResponseData =Sr. ReadToEnd ();
returnResponseData; }}
"Request aborted: Failed to create SSL/TLS secure channel" workaround