[Solved] The request was aborted: Could not create SSL/TLS secure channel
Error: The request was aborted: Could not create SSL/TLS secure channel
Solution:
Add Following code before calling any Secure API or any Secure Web URL.
ServicePointManager.Expect100Continue = true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
Example:
ServicePointManager.Expect100Continue = true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; new WebClient().DownloadData("https://websiteurl.com/method...");
ServicePoint Class:
The ServicePoint class handles connections to an Internet resource based on the host information passed in the resource’s Uniform Resource Identifier (URI). The initial connection to the resource determines the information that the ServicePoint object maintains, which is then shared by all subsequent requests to that resource. Ref: https://msdn.microsoft.com/en-us/library/system.net.servicepoint(v=vs.110).aspx
ServicePointManager Class:
ServicePointManager is a static class used to create, maintain, and delete instances of the ServicePoint class.
Ref: https://msdn.microsoft.com/en-us/library/system.net.servicepointmanager(v=vs.110).aspx