Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
4.3k views
in FAQ: edtFTPnet/PRO by (162k points)
closed by
Why not use FtpWebRequest instead of edtFTPnet/PRO?
closed with the note: Answered

1 Answer

0 votes
by (20.4k points)
 
Best answer

Microsoft's FtpWebRequest has a very awkward interface and implements very few features. Our SecureFTPConnection offers an intuitive interface and offers a very broad range of features.
Here's an example of how to list a directory with FtpWebRequest:

            // Get the object used to communicate with the server.
            FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://www.whatever.com/");
            request.Method = WebRequestMethods.Ftp.ListDirectoryDetails;

            // This example assumes the FTP site uses anonymous logon.
            request.Credentials = new NetworkCredential ("anonymous","janeDoe@contoso.com");

            FtpWebResponse response = (FtpWebResponse)request.GetResponse();
    
            Stream responseStream = response.GetResponseStream();
            StreamReader reader = new StreamReader(responseStream);
            Console.WriteLine(reader.ReadToEnd());

            Console.WriteLine("Directory List Complete, status {0}", response.StatusDescription);
    
            reader.Close();
            response.Close();

You get raw text returned.
With edtFTPnet/PRO:

FTPFile[] files = ftp.GetFileInf
...