Web Service 初级教程

访问Https的Web services

 

加入下面代码,什么证书都接受。

 static WebServices()
 {
            ServicePointManager.ServerCertificateValidationCallback =
                new RemoteCertificateValidationCallback(CheckValidationResult);
 }
private static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslpolicyerrors)
{
           return true;
}

Http 用户密码验证

导入Wsdl文件之后,加入

var webServiceClient = new WebReference.AManager();
a.Credentials = new NetworkCredential(userName, password);

posted @ 2011-03-10 15:05  沉默的糕点  阅读(249)  评论(0编辑  收藏  举报