-1

I want to download a file from the FTP server via SSL. If I don't enable enableSSL, the download works. If I activate enableSSL, I get the error message "(530) Not logged in". We have a vManaged Server. Does something on the server have to be changed for enableSSL to work or what am I doing wrong?

        FtpWebRequest ftpWebRequest = (FtpWebRequest) WebRequest.Create("ftp://meineSeite/03-29-18_16-04-28_078.pdf");

        ftpWebRequest.Credentials = new NetworkCredential(userName: "hansMeier", password: "test1232121321");

        ftpWebRequest.Method = WebRequestMethods.Ftp.DownloadFile;

        ftpWebRequest.EnableSsl = true;

        Stream responseStream = ftpWebRequest.GetResponse().GetResponseStream();

        using (FileStream fileStream = new FileStream(@"C:\Users\Assembly\Desktop\FtpTest\test.pdf", FileMode.Create))
        {
            responseStream.CopyTo(fileStream);
        }

        Console.WriteLine("Download erfolgreich");

        Console.ReadLine();
Kenster
  • 23,465
  • 21
  • 80
  • 106
Ameise
  • 35
  • 3

1 Answers1

0

try Normalize() Method with your username and password like this

 ftpWebRequest.Credentials = new NetworkCredential(
 usernameVariable.Normalize(),
 passwordVariable.Normalize(),
 domainVariable.Normalize()
);

Hope it helps !!

Tahir
  • 69
  • 1
  • 5
  • Why should this help? The credentials are pure ascii. – Martin Prikryl Apr 04 '18 at 08:53
  • This might be useful to you !! https://social.msdn.microsoft.com/Forums/vstudio/en-US/f93be807-939e-4859-8815-f288e194d61d/ftp-error-the-remote-server-returned-an-error-530-not-logged-in?forum=csharpgeneral – Tahir Apr 04 '18 at 08:58