We are using Restsharp in a .NET 4.8 solution for http requests.
We need to bypass ssl validation for http calls for some time until we fix the cert issue.
RestSharp Version=105.2.3.0 is the version used.
We can see in forums for bypassing the ssl and applied that to our code like below but it complains method definition
Class1
{
private readonly IRestClient _restClient;
public Class1(IRestClient restClient)
{
_restClient = restClient;
}
GetApi()
{
restClient.RemoteCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
RestRequest request = new RestRequest(url, Method.GET);
IRestResponse response = _restClient.Execute(request);
}
}
There is an alternate solution for this suggested in forums, but it says it will apply to entire application.
If we use the code shown here, will it be applied to only that method or is it going to impact all the http calls?
ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true;
Thanks