我需要使用SSL牛逼建立到服务器的连接在C#winApplication使用SSL
描述: 我工作的一个Windows应用程序项目中,我们使用“Web服务”,以数据与数据库进行通信。 服务器端服务是用Java编写的,我正在用C#做UI部分。现在我想用SSL与服务器建立安全连接,但是我找不到一种方法来跳过生成的警告消息尝试建立连接时(使用C#代码)。
样本将帮助我很多,
这是我的代码使用方法:
地址:
public bool UserLogIn (User user)
{
logon logIn = new logon();
logIn.arg0 = new userAthenticationRq();
logIn.arg0.credential = GetCredential(user);
logIn.arg0.clientIpAddress = GetClientIP();
logIn.arg0.requstDate = DateTime.Now;
logIn.arg0.requstDateSpecified = true;
logIn.arg0.userName = user.Name;
logonResponse rsp = new logonResponse();
ServicePointManager.ServerCertificateValidationCallback += new System.Net.Security.RemoteCertificateValidationCallback(ValidateRemoteCertificate);
rsp = service.logon(logIn);//this is where the Exception Occurs
if ([email protected] == statusCodeEnum.SUCCESS)
.
.
.
}
这是关于无效SSL证书的错误吗? – w69rdy 2010-07-13 10:51:49
请参阅[如何使用c#2.0 WebClient忽略证书错误 - 无证书](http://stackoverflow.com/questions/1301127/how-to-ignore-a-certificate-error-with-c-2-0 -webclient-without-the-certificate) – 2010-07-13 10:52:21
您不需要将您的电子邮件作为问题的一部分发布。我已经把它关闭了... – 2010-07-13 12:29:56