qr

fistfulofbytes

How to bypass SSL validation for Exchange Webservices Managed API

permalink: ffbyt.es/rhNE

3 February 2009

Index

This article is briefly describes how to setup a sample application that works with OPC clients.

Turns out that at my first day at work I had to wrestle with this stuff.. because I was looking for exchange specific solution I failed… if it had occur to me to look for a WCF specific thing it would have saved me a ton of time…

anyways here is what you need to do in your code declare these

Code

using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;

public static bool OnValidationCallback(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors errors)
{
    return true;
}

put this before your code executes

ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(OnValidationCallback);

and you are good to go..

By Sevki

Related articles