Hi, Can the Rebex.NET.FTP able to connect to the FTP server using Active mode?

It works great when connecting to a ftp server which is running in passive mode. But it can't get directory listing using passive mode.

I have a microsoft windows 2008 server running Filezilla FTP server and using an public IP address but protected by MIcrosoft Firewall. It can only operate in Active mode.

my coding is as follows:

        string FTPServer = getFTPServer(SiteCode);
        string FTPUser = getFTPuser(SiteCode);
        string FTPPass = getFTPpass(SiteCode);

        Ftp client = new Ftp();

        client.TransferMode = FtpTransferMode.Stream;
        client.Connect(FTPServer);
        client.Login(FTPUser, FTPPass);

        string pathstr = Server.MapPath("/GlobalFiles");

        pathstr = pathstr + "\\*";

        client.PutFiles(@pathstr, "/", FtpBatchTransferOptions.Recursive, FtpActionOnExistingFiles.OverwriteOlder);

Many thanks, Eddie

asked 11 Oct '10, 08:19

Eddie's gravatar image

Eddie
324
accept rate: 0%


Yes, Rebex FTP supports active mode. However, in order to use it, you have to disable passive mode:

    ...

    Ftp client = new Ftp();

    // instruct the Ftp object to use active mode
    client.Passive = false; // <-- add this line

    client.TransferMode = FtpTransferMode.Stream;
    client.Connect(FTPServer);
    client.Login(FTPUser, FTPPass);

    ...
link

answered 11 Oct '10, 12:12

Lukas%20Pokorny's gravatar image

Lukas Pokorny ♦♦
2.4k28
accept rate: 31%

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
×5
×4

Asked: 11 Oct '10, 08:19

Seen: 1,233 times

Last updated: 11 Oct '10, 12:12