I am using Rebex to download an EDI File off of a FTP site. It is a standard FTP site, not SFTP or FTPS.

When I download the file, the local file is gibberish, like it is encrypted or something. However if I download the file from the FTP using a client such as FileZilla the file is plain text as it should be.

Text of File should look something like this: ISA*00* 00 *11*XX0XQ933P *ZZ*6750 *110207*0536*U*00400*000000214*0*P*>\

Instead it looks like this: ÉâÁ\ðð\@@@@@@@@@@\ðð\@@@@@@@@@@\ññ\×Óðñøôùóó×@@@@@\éé\öñôð@@@@@@@@@@@\ññðòð÷\ðõóö\ä\ððôðð\ððððððòñô\ð\×\nàÇâ\âÃ\óñøööòñðôð\

Here is sample code:

private static void FtpDownloadFile(string hostName, int port, 
     string username, string password, string initialDirectoryName, 
     string downloadDirectoryPath, string fileName)
    {
        //create download directory if it does not exist
        if (!Directory.Exists(downloadDirectoryPath))
        {
            Directory.CreateDirectory(downloadDirectoryPath);
        }

        if (!string.IsNullOrEmpty(fileName))
        {
            initialDirectoryName += "/" + fileName;
            downloadDirectoryPath += "\\" + fileName;
        }

        //connect to SSH FTP
        Rebex.Net.Ftp client = null;

        client = new Rebex.Net.Ftp();
        client.Connect(hostName, port);
        client.Login(username, password);

        client.GetFile(initialDirectoryName, downloadDirectoryPath);

        //disconnect
        client.Disconnect();
    }

asked 07 Feb '11, 20:17

Dave's gravatar image

Dave
284
accept rate: 0%

edited 07 Feb '11, 20:23


Try setting the FTP client transfer mode to ASCII as follows:

    ...

    client.TransferType = FtpTransferType.Ascii;
    client.GetFile(initialDirectoryName, downloadDirectoryPath);

    //disconnect
    client.Disconnect();

If it does not help please create two log files and either include them in your post or mail them to support@rebex.net for analysis:

  1. Rebex FTP log file using a LogWriter property as described here.
  2. FileZilla log file

Differences between the two should help us to determine what went wrong.

link

answered 07 Feb '11, 20:59

Martin%20Vobr's gravatar image

Martin Vobr ♦♦
335310
accept rate: 37%

That worked. Thank you.

(07 Feb '11, 21:21) Dave
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×152
×13

Asked: 07 Feb '11, 20:17

Seen: 1,158 times

Last updated: 07 Feb '11, 20:59