// Create a FTPCredentials FtpWebRequest ftpRequest = (FtpWebRequest)WebRequest.Create(strFTPServer + "/" + strRemoteDirectory + "/"); ftpRequest.Credentials = new NetworkCredential(strFTPUser, strFTPPassword); ftpRequest.Method = WebRequestMethods.Ftp.ListDirectory; // Associate the new Uri object to the myProxy object. WebProxy myProxy = new WebProxy(); Uri newUri = new Uri(strProxyAddress); myProxy.Address = newUri; // Create a NetworkCredential object. myProxy.Credentials = new NetworkCredential(strUserName, strPassword); ftpRequest.Proxy = myProxy; //DownLoad file ftpRequest.Method = WebRequestMethods.Ftp.DownloadFile; FtpWebResponse response = (FtpWebResponse)ftpRequest.GetResponse(); StreamReader streamReader = new StreamReader(response.GetResponseStream()); MemoryStream memStream = new MemoryStream(); List<string> directories = new List<string>(); string line = streamReader.ReadLine(); while (!string.IsNullOrEmpty(line)) { directories.Add(line); line = streamReader.ReadLine(); }
ReadLine
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)