I am trying to access a web api using below C# code :
private static CertificateContext authenticationContext;
authenticationContext = new CertificateContext(new Uri(endpoint), ThumbPrint);
var client = authenticationContext.GetHttpClient();
var response = await client.GetStringAsync(url);
It was working fine initially but later i am getting below error:
The request was aborted: Could not create SSL/TLS secure channel.
I checked some forums and as per the suggestions i tried with below options, but nothing worked for me
1.ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
2.ServicePointManager.ServerCertificateValidationCallback = delegate (object s, X509Certificate certificate, X509Chain chain,
SslPolicyErrors sslPolicyErrors) { return true; };
Kindly help me to fix this error. Thanks in advance