using webrequest c# code example
Example: .net core c# webrequest download
byte[] listeByte;
try
{
FtpWebRequest requestFichier = (FtpWebRequest)WebRequest.Create(@filePath);
requestFichier.Credentials = new NetworkCredential(utilisateur, motDePasse);
requestFichier.Method = WebRequestMethods.Ftp.DownloadFile;
using (WebResponse response = await requestFichier.GetResponseAsync())
{
using (MemoryStream ms = new MemoryStream())
{
response.GetResponseStream().CopyTo(ms);
listeByte = ms.ToArray();
}
}
}
catch (Exception ex)
{
throw ex;
}
return listeByte;