我能够通过身份验证,但我不知道如何读取CSV文件.通常从硬盘驱动器链接我这样读.
string[] allLines = System.IO.File.ReadAllLines(@"D:\CSV\data.csv");
Run Code Online (Sandbox Code Playgroud)
但是我如何从ftp中读取.我的Ftp路径就像ftp://ftp.atozfdc.com.au/data.csv 这是我通过ftp身份验证的代码.
String ftpserver = "ftp://ftp.atozfdc.com.au/data.csv";
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(ftpserver));
reqFTP.UsePassive = false;
reqFTP.UseBinary = true;
reqFTP.Credentials = new NetworkCredential("username", "password");
reqFTP.Method = WebRequestMethods.Ftp.DownloadFile;
reqFTP.Proxy = GlobalProxySelection.GetEmptyWebProxy();
FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
Run Code Online (Sandbox Code Playgroud)