0 votes
by (120 points)
edited

We are testing the Rebex component. Specifically we are testing the FTP SSL for .NET 2.0 Trial component. The code in C# is as follows

   //Create Rebex FTP Component    
   Ftp rebexFTP = new Ftp();    
   rebexFTP.Connect(strURL,  20021, null, FtpSecurity.Explicit);    
   rebexFTP.Login(strUser strPass);    
   rebexFTP.ChangeDirectory(FTPHomeDirectory);    
   rebexFTP.ChangeDirectory(FTPUploadDirectory);    
   numBytes = rebexFTP.PutFile(strFileName);

The good news is that this code works – we are able to Connect using the port, Login, Change Directories and Upload the file. The only problem is that this file is sent in binary format and needs to be sent in ASCII format. Is there a way to tell the Rebex component to upload the file in ASCII on the PutFile method?

When we test using a FTP client Core FTP we are able to upload the file in ASCII format using the same Login, port directories etc.

Applies to: Rebex FTP/SSL

1 Answer

0 votes
by (13.3k points)
edited

The Ftp class default transfer mode is binary. To upload file in ASCII format try setting the TransferType property to FtpTransferType.Ascii first.

//Create Rebex FTP Component    
Ftp rebexFTP = new Ftp();    
rebexFTP.Connect(strURL,  20021, null, FtpSecurity.Explicit);    
rebexFTP.Login(strUser strPass);    
rebexFTP.ChangeDirectory(FTPHomeDirectory);    
rebexFTP.ChangeDirectory(FTPUploadDirectory); 

// change transfer mode to ASCII and upload the file
rebexFTP.TransferType = FtpTransferType.Ascii;
numBytes = rebexFTP.PutFile(strFileName);
...