Okay, now i can post code. I kept getting errors from the server.
This is the code:
var ftp = new FTPConnection()
{
ConnectMode = FTPConnectMode.PASV,
ServerAddress = CitFtpSite,
UserName = CitUserName,
Password = CitPassword,
TransferType = FTPTransferType.BINARY,
ServerDirectory = "/Outbox"
};
ftp.Connect();
FTPConnection.LogLevel = LogLevel.Debug;
FTPConnection.LogFile = @"P:\logs.txt";
var filename = Environment.CurrentDirectory +@"\"+ string.Format("CCData{0:MMddyyhhMMss}.txt",DateTime.Now);
//try
{
ftp.DownloadFile(filename,"CCDATA.TXT");
}
When I get the error, I get this log entry:
DEBUG [FTPConnection] 8 Sep 2015 09:37:17.027 : DownloadFile(C:\Projects\Badger Central\Source\Feature\0823\Factoring\Badger.Core.Services.Tests\bin\Debug\CCData090815090917.txt,CCDATA.TXT)
DEBUG [FTPControlSocket] 8 Sep 2015 09:37:17.030 : ---> REST 0
DEBUG [FTPControlSocket] 8 Sep 2015 09:37:17.076 : 350 Restarting at 0. Send STORE or RETRIEVE
DEBUG [FTPControlSocket] 8 Sep 2015 09:37:17.081 : ---> PASV
DEBUG [FTPControlSocket] 8 Sep 2015 09:37:17.133 : 227 Entering Passive Mode (206,212,89,52,120,228)
DEBUG [FTPControlSocket] 8 Sep 2015 09:37:17.134 : Server supplied address=206.212.89.52
DEBUG [FTPControlSocket] 8 Sep 2015 09:37:17.134 : Server supplied port=30948
DEBUG [FTPControlSocket] 8 Sep 2015 09:37:17.134 : autoPassiveIPSubstitution=True
DEBUG [FTPControlSocket] 8 Sep 2015 09:37:17.134 : remoteAddr=206.212.89.52
DEBUG [FTPControlSocket] 8 Sep 2015 09:37:17.135 : Substituting server supplied IP (206.212.89.52) with remote host IP (206.212.89.52)
DEBUG [FTPControlSocket] 8 Sep 2015 09:37:17.135 : NewPassiveDataSocket(206.212.89.52,30948)
INFO [BaseSocket] 8 Sep 2015 09:37:17.136 : Connecting to 206.212.89.52:30948 with timeout 120000 ms
DEBUG [BaseSocket] 8 Sep 2015 09:37:17.178 : Successfully connected to 206.212.89.52:30948
DEBUG [FTPControlSocket] 8 Sep 2015 09:37:17.178 : Connected
DEBUG [FTPControlSocket] 8 Sep 2015 09:37:17.178 : ---> RETR CCDATA.TXT
DEBUG [FTPControlSocket] 8 Sep 2015 09:37:17.391 : 554 Invalid REST argument.
INFO [FTPControlSocket] 8 Sep 2015 09:37:17.392 : Expected reply codes = [125,150] (strict=False)
ERROR [FTPClient] 8 Sep 2015 09:37:17.393 : Caught exception Invalid REST argument. (code=554)
ERROR [FTPClient] 8 Sep 2015 09:37:17.394 : Caught exception
ERROR [FTPClient] 8 Sep 2015 09:37:17.394 : EnterpriseDT.Net.Ftp.FTPException: Invalid REST argument. (code=554)
ERROR [FTPClient] 8 Sep 2015 09:37:17.394 : at EnterpriseDT.Net.Ftp.FTPControlSocket.ValidateReply(FTPReply reply, String[] expectedReplyCodes)
ERROR [FTPClient] 8 Sep 2015 09:37:17.394 : at EnterpriseDT.Net.Ftp.FTPClient.InitGet(String remoteFile)
ERROR [FTPClient] 8 Sep 2015 09:37:17.394 : at EnterpriseDT.Net.Ftp.FTPClient.GetBinary(String localPath, String remoteFile)
WARN [FTPConnection] 8 Sep 2015 09:37:17.398 : Could not get length of file 'C:\Projects\Badger Central\Source\Feature\0823\Factoring\Badger.Core.Services.Tests\bin\Debug\CCData090815090917.txt'
WARN [FTPConnection] 8 Sep 2015 09:37:17.398 : System.IO.FileNotFoundException: Could not find file 'C:\Projects\Badger Central\Source\Feature\0823\Factoring\Badger.Core.Services.Tests\bin\Debug\CCData090815090917.txt'.
WARN [FTPConnection] 8 Sep 2015 09:37:17.398 : at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
WARN [FTPConnection] 8 Sep 2015 09:37:17.398 : at System.IO.FileInfo.get_Length()
WARN [FTPConnection] 8 Sep 2015 09:37:17.398 : at EnterpriseDT.Net.Ftp.FTPConnection.GetLocalFileSize(String localPath)
The thing is I'm not trying to send a REST or get file size. I just want to download the file, and they won't let us use our VAN to send or retrieve the files.