RestSharp - Ignore SSL errors

Michael Skarum picture Michael Skarum · May 1, 2012 · Viewed 43k times · Source

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.

Answer

Michael Skarum picture Michael Skarum · Jun 21, 2013

As John suggested:

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