From ASP.NET web site I’m calling web service (which requires certificate). When I testing it on localhost (debugging) it works, but on IIS 6 (windows server 2003) it does not works and throws an exception:
The request failed with HTTP status
403: Forbidden.
Here is the code, how I’m calling web service:
Service service = new Service();
service.ClientCertificates.Add(new X509Certificate("certificate path", "password"));
service.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(ValidationCallBack);
Result res = service.GetResult();
private static bool ValidationCallBack(object sender, X509Certificate cert, X509Chain chain, System.Net.Security.SslPolicyErrors error)
{
return true;
}
What is the reason of this error and how can I avoid this?
I’ve tried web service call with winForms and it works fine on server. So I think it is IIS problem…
Thanks!
To resolve this you should look at this link