FTP 通过 SSL 到 z/OS 列出目录文件
FTP over SSL to z/OS to List Directory Files
我正在尝试连接到 z/OS FTP 服务器以下载文件,但首先我需要列出它们以便找出哪个是最新的。服务器有一个我必须信任的未知证书,我使用了下面的代码,其中包含关于不在生产中使用的警告
ServicePointManager.ServerCertificateValidationCallback =
delegate (
object s,
X509Certificate cert,
X509Chain chain,
SslPolicyErrors sslPolErrors) { return true; };
我很难列出我要查找的目录中的文件。看来z/OS真的很痛苦。我基本上需要通过 SSL 连接到 FTP 服务器,我设法做到了,但事实证明更改工作目录很困难。
string ftpPath = @"ftp://192.168.1.1/'THE.DIRECTORY.I.NEED.TO.CONNECT.TO'";
FtpWebRequest request = (FtpWebRequest)WebRequest.Create(remoteFtpPath);
request.Method = WebRequestMethods.Ftp.ListDirectory;
request.Credentials = new NetworkCredential("username","password");
request.KeepAlive = request.UsePassive = request.EnableSsl = true;
Am I connecting to the working directory I need with my ftpPath
string? If not, what's the proper way of changing working directory? The only way I've seen to do it after some google research is to include it in my ftpPath
string.
我这样做的错误是 550 No data sets found...
ListDirectory
方法的 URL 通常应以斜线结尾。
如果没有斜线,结果往往不确定,主要取决于 FTP 服务器实施。
我正在尝试连接到 z/OS FTP 服务器以下载文件,但首先我需要列出它们以便找出哪个是最新的。服务器有一个我必须信任的未知证书,我使用了下面的代码,其中包含关于不在生产中使用的警告
ServicePointManager.ServerCertificateValidationCallback =
delegate (
object s,
X509Certificate cert,
X509Chain chain,
SslPolicyErrors sslPolErrors) { return true; };
我很难列出我要查找的目录中的文件。看来z/OS真的很痛苦。我基本上需要通过 SSL 连接到 FTP 服务器,我设法做到了,但事实证明更改工作目录很困难。
string ftpPath = @"ftp://192.168.1.1/'THE.DIRECTORY.I.NEED.TO.CONNECT.TO'";
FtpWebRequest request = (FtpWebRequest)WebRequest.Create(remoteFtpPath);
request.Method = WebRequestMethods.Ftp.ListDirectory;
request.Credentials = new NetworkCredential("username","password");
request.KeepAlive = request.UsePassive = request.EnableSsl = true;
Am I connecting to the working directory I need with my
ftpPath
string? If not, what's the proper way of changing working directory? The only way I've seen to do it after some google research is to include it in myftpPath
string.
我这样做的错误是 550 No data sets found...
ListDirectory
方法的 URL 通常应以斜线结尾。
如果没有斜线,结果往往不确定,主要取决于 FTP 服务器实施。