FtpWebRequest EnableSsl = true错误'根据验证过程,远程证书无效3

我尝试通过激活Enabled选项ssl = true来通过ftpwebrequest类通过ssl连接到ftp服务器

  

根据验证过程,远程证书无效。

这是我的密码

public void Upload(string container,string fileName,byte[] b)
        {
            Uri fullUri = new Uri(string.Format(@"{0}/{1}/{2}",Host,container,fileName));
            FtpWebRequest ftps = (FtpWebRequest)FtpWebRequest.Create(fullUri);
            ftps.Credentials = getcredentials();

            ftps.KeepAlive = false;
            ftps.Method = WebRequestMethods.Ftp.UploadFile;
            ftps.UseBinary = true;
            ftps.EnableSsl = Ssl;
            ftps.ContentLength = b.Length;
            using (Stream StreamRequest = ftps.GetRequestStream())
            {
                StreamRequest.Write(b,b.Length);
                StreamRequest.Close();
            }
        }

我已经看到,在某些出版物中,他们使用诸如

servicepointManager.ServerCertificateValidationCallback = delegate(object s,X509Certificate certificate,X509Chain chain,SslPolicyErrors sslPolicyErrors) { return true; };

但是我不知道它的正确性或是否必须获得证书并给予类似的验证

lgh19751228 回答:FtpWebRequest EnableSsl = true错误'根据验证过程,远程证书无效3

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3113779.html

大家都在问