I\'m trying to bypass https certificate validation only to our own testing environment (multiple machines), while trying to keep certificate validation for all the other connect
What you could do is place a setting in Your web.config file.
Then in Your code check the value in the web.config file. Then set the certificate validation depending on that value.
Edit
One option is:
String url = "https://www.stackoverflow.com";
HttpWebRequest request = HttpWebRequest.CreateHttp(url);
request.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => { return true; };
Another is: http://weblog.west-wind.com/posts/2011/Feb/11/HttpWebRequest-and-Ignoring-SSL-Certificate-Errors
Edit 2
Try something like this:
ServicePointManager.ServerCertificateValidationCallback += customXertificateValidation;
private static bool customXertificateValidation(object sender, X509Certificate cert,
X509Chain chain, SslPolicyErrors error)
{
if (check something here)
{
return true;
}
return false;
}