How can I configure FTP component for ProxySG proxy?

0 votes
asked Apr 12, 2013 by Rebex KB (8,220 points)
edited Apr 12, 2013

Hi,

Does Rebex FTP/SSL component support ProxySG? I was able to connect via ProxySG with FileZilla client following this tutorial.

Applies to: Rebex FTP/SSL

1 Answer

0 votes
answered Apr 12, 2013 by Tomas Knopp (58,890 points)
edited Apr 12, 2013
 
Best answer

Hello,

connecting to an FTP server via ProxySG proxy is possible with Rebex FTP component. The protocol for ProxySG corresponds to the following FTP commands:

USER %userName@%host %proxyUser
PASS %password
ACCT %proxyPassword

Practically you Connect to the proxyHost first and then use Login method like this:

                string host = "ftp.company.com";
                string userName = "user";
                string password = "pass";

                string proxyUser = "proxyUser";
                string proxyPassword = "proxyPass";
                string proxyHost = "proxyHost";

                Ftp ftp = new Ftp();

                // connect to the proxy server
                ftp.Connect(proxyHost);

                // create username in the special format "username@host proxyUser"
                string user = string.Format("{0}@{1} {2}", userName, host, proxyUser);

                // login with the specially created username
                // provide password as 2nd and proxyPassword as 3rd argument to the Login method
                ftp.Login(user, password, proxyPassword);

                //do work

                ftp.Disconnect();
...