SSL error with http request

The solution for this problem can be quite simple.
Before first use of HTTP request add “Invoke Code” activity and put the following code:

    System.Net.ServicePointManager.ServerCertificateValidationCallback +=
    (sender, cert, chain, sslPolicyErrors) => true;

It is in C#, so port it into VB.NET if you prefer it.
Use this code only for dev/test cases. In prod if you still need to use self-signed SSL certificates then inside of callback add check for your certificate.
For example(brought it from stackoverflow):

ServicePointManager.ServerCertificateValidationCallback += 
    (sender, cert, chain, error) =>
{
    if (cert.GetCertHashString() == "xxxxxxxxxxxxxxxx") // !!! Change xxxxxxxxxxxxxxxx for your certificate hash
    {
        return true;
    }
    else
    {
       return error == SslPolicyErrors.None;
    }
};

Pay attention to the comment " Change xxxxxxxxxxxxxxxx for your certificate hash"

Reference: RemoteCertificateValidationCallback Delegate (System.Net.Security) | Microsoft Learn

4 Likes