Search code examples
httpsrestsharp

RestSharp - Ignore SSL errors


Is there any whay that I can get RestSharp to ignore errors in SSL certificates? I have a test client, and the service I connect to does not yet have a valid cetificate.

When I make a request now I get the error:

The underlying connection was closed: Could not establish trust 
relationship for the SSL/TLS secure channel.

Solution

  • As John suggested:

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