Home > Programming > Invalid SSL certificate

Invalid SSL certificate

While trying to invoke a web service in one of my development environments, I received this exception:

Could not establish trust relationship for the SSL/TLS secure channel.

There are a number of reasons why this may happen, but in my particular case I was using a self-signed SSL certificate for testing. To bypass the invalid certificate for testing, we can replace the certificate validation with our own:

ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };

This implementation returns true, regardless if the certificate is valid or not.  One thing to keep in mind is that this setting will affect all subsequent requests from the current application domain.

  1. August 18, 2014 at 5:10 am

    hey there and thank you for your information – I have definitely picked up anything new from right here.
    I did however expertise a few technical points using
    this website, as I experienced to reload the web site many times previous to I could
    get it to load correctly. I had been wondering if your web hosting is OK?
    Not that I’m complaining, but sluggish loading instances times will often affect your placement
    in google and could damage your high-quality score if ads and marketing with Adwords.
    Anyway I’m adding this RSS to my email and can look out for
    a lot more of your respective interesting content.
    Ensure that you update this again very soon.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: