Answers for ".net core c# webrequest download"

C#
0

.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;
Posted by: Guest on March-05-2020

C# Answers by Framework

Browse Popular Code Answers by Language