I have run the code with these changes:
this.ftpConnection1.EventsEnabled = true;
if (OnDownloading(localPath, remoteFile))
As you can se in the log, it sends a SIZE command to the FTP and expects 213 but retrieves 226.
This results in a 0 kb file and an exception from ValidateReply() in FTPControlSocket.cs
If I turn off events, then the SIZE command will never be sent.
DEBUG [EnterpriseDT.Net.Ftp.FTPClient] 11 okt 2005 11:07:21.371 : Connecting to 127.0.0.1:21
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 11 okt 2005 11:07:21.403 : 220 Microsoft FTP Service
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 11 okt 2005 11:07:23.403 : ---> USER XXXXXX
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 11 okt 2005 11:07:23.403 : 331 Password required for XXXXXX.
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 11 okt 2005 11:07:24.575 : ---> PASS ********
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 11 okt 2005 11:07:24.575 : 230 User XXXXXX logged in.
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 11 okt 2005 11:07:25.293 : ---> TYPE A
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 11 okt 2005 11:07:25.293 : 200 Type set to A.
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 11 okt 2005 11:07:25.981 : ---> SIZE TextDocument.txt
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 11 okt 2005 11:07:25.981 : 213 16950
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 11 okt 2005 11:07:26.606 : ---> PASV
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 11 okt 2005 11:07:26.606 : 227 Entering Passive Mode (127,0,0,1,8,32).
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 11 okt 2005 11:07:27.184 : ---> RETR TextDocument.txt
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 11 okt 2005 11:07:27.184 : 125 Data connection already open; Transfer starting.
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 11 okt 2005 11:07:27.809 : ---> SIZE TextDocument.txt
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 11 okt 2005 11:07:27.809 : 226 Transfer complete.
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 11 okt 2005 11:07:33.637 : ---> SIZE TextDocument.txt
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 11 okt 2005 11:07:33.637 : 213 16950
/ Carl