我有一个简单的WebClient和FTP管理器。
我要从FTP服务器删除文件并上传,但已更新。
主要问题是The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel." "The remote certificate is invalid according to the validation procedure.
我尝试了论坛上的所有修复方法,但是没有用。
client.Credentials = new NetworkCredential("user", "password");
FtpWebRequest requestFileDelete = (FtpWebRequest)WebRequest.Create("ftp://(url)" + file);
requestFileDelete.Method = WebRequestMethods.Ftp.DeleteFile;
FtpWebResponse responseFileDelete = (FtpWebResponse)requestFileDelete.GetResponse();
client2.Credentials = new NetworkCredential("user", "password");
client2.UploadFile("ftp://(url)/log.log", Temppath2 + "/log.txt");
File.Delete(filepath);