SSL connection error in windows project in UiPath

Hi, I created a nuget in c# to call an API with get method where i am calling an Https requests with no SSL ceritification, In order to disable the SSL certificate validation, i am using below expression:
ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;

Awkward is that this nuget is working with windows legacy projects but giving error in widows projects in UiPath. the error is: The SSL connection could not be established.

Please help. Thanks in advance.


The following might help you.


Hi @confuse_coder

To resolve this issue, you can try the following steps:

  1. Import the System.Net namespace: Make sure you have the System.Net namespace imported at the beginning of your code file. This namespace contains the ServicePointManager class that you need to modify.

using System.Net;

2. Instead of using the lambda expression, try explicitly disabling SSL certificate validation using the `ServicePointManager` class before making the HTTPS request. Use the `ServerCertificateValidationCallback` property and assign it to a method that always returns true:

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


Hi Nitya, I’ve tried passing the value true also but didn’t help in windows project, As said its working fine in windows-legacy projects, please find my source code.
classLibrarySourceCode.txt (2.7 KB)