Yesterday during my development, I have to use a web service on https in my C# program. I created my own self signed certificate with IIS 7. I installed it and then bammmm got this error "The remote certificate is invalid according to the validation procedure" while calling the web service.
The solution to fix this problem was a valid certificate for my machine.. but I was not able to create one... so Then I found the solution, that I can override certificate checking using the following code...
ServicePointManager.ServerCertificateValidationCallback += delegate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
bool validationResult = true;
//
// policy code here ...
//
return validationResult
};
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment