filezilla download file location C3 code example
Example: download file from ftp c#
using System;
using System.IO;
using System.Net;
namespace Examples.System.Net
{
public class WebRequestGetExample
{
public static void Main ()
{
FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://www.contoso.com/test.htm");
request.Method = WebRequestMethods.Ftp.DownloadFile;
request.Credentials = new NetworkCredential("anonymous","[email protected]");
FtpWebResponse response = (FtpWebResponse)request.GetResponse();
Stream responseStream = response.GetResponseStream();
StreamReader reader = new StreamReader(responseStream);
Console.WriteLine(reader.ReadToEnd());
Console.WriteLine($"Download Complete, status {response.StatusDescription}");
reader.Close();
response.Close();
}
}
}