C# FTP 550 error

前端 未结 6 793
抹茶落季
抹茶落季 2021-01-20 03:31

I\'m trying to programatically download a file in C# via FTP, here is the relevant code (obviously with fake credntials and URI):

try
{
    var request = Ftp         


        
6条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-20 04:12

    Here is what I use, I bet the .Method is the main thing you are missing

            request = (FtpWebRequest)FtpWebRequest.Create(address);
            request.Credentials = new NetworkCredential("username", "password");
            request.UsePassive = true;
            request.UseBinary = true;
            request.Proxy = null;
    
            request.Method = WebRequestMethods.Ftp.DownloadFile;
            FtpWebResponse dataResponce = (FtpWebResponse)request.GetResponse();
    

提交回复
热议问题