Come ottenere la lista delle directory e dei file remoti
utilizzando gli oggetti FtpWebRequest e FtpWebResponse
System.Net.FtpWebRequest conn =null ;
System.Net.FtpWebResponse resp = null;
conn = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://localhost"));
conn.Credentials = new NetworkCredential("username", "password");
conn.KeepAlive = false;
conn.Method = WebRequestMethods.Ftp.ListDirectoryDetails;
resp = (FtpWebResponse)(conn.GetResponse());
StreamReader strReader = new StreamReader(resp.GetResponseStream(), System.Text.ASCIIEncoding.ASCII);
string strItems = strReader.ReadToEnd();
string[] arrItems = strItems.Split("\n".ToCharArray());
strReader.Close();