I tried to download a .bak file from the FTP and save it into a local directory in my pc.
This is my code:
Try
My.Computer.Network.DownloadFile("ftp://nameOfServer/file.bak", "C:\Users\Admin\Documents\BackUp\file.bak", "user", "password")
Catch ex As Exception
MessageBox.Show(ex.Message, "Error")
End Try
When I execute the code I get this error:
Error on the remote server: 227 Entering Passive Mode(xxx,xx,xxx,xxx,xxx,xx)
I know that I need to change it to active mode, but I can´t find a way works correctly with my code. How can I solve that? thanks
You should make sure you are downloading the files correctly by following this older edit.
But another possible cause for your problems may have been simply caused by the output directory being missing, or more likely write protected (either by security policies or folder settings).
Finally if you have everything correct code and file-structure wise, I would advise contacting the ftp provider, and make sure the ftp server is configured and optimized properly for your use. If you cannot contact your ftp provider for help yet you can access your ftp settings, I would recommend disabling passive mode all-together for your ftp server at your own risk.