cause of The request was aborted: Could not create SSL/TLS secure channel. code example

Example 1: could not create ssl/tls secure channel

// using System.Net;
ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
// Use SecurityProtocolType.Ssl3 if needed for compatibility reasons

Example 2: the request was aborted could not create ssl/tls secure channel. c# restsharp

//Add this line of code before RestClient
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;

Example 3: C# The request was aborted: Could not create SSL/TLS secure

ServicePointManager.Expect100Continue = true;
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls
                   | SecurityProtocolType.Tls11
                   | SecurityProtocolType.Tls12
                   | SecurityProtocolType.Ssl3;