Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
3.2k views
in .NET FTP by (480 points)
I'm STILL new to all this C# stuff. But Am well on my way. For some reason when I try and get files I need to get files first in ASCII then in Binary. I dont know how to change the connection. The only way I got round it was to drag 2 FTP controls onto the form and set one of them as ASCII and one as BINARY. When I programmed these i did binary first. When it finished and closed I tried to connect to the server with the second connection. It then threw me out because it says "Broken Client" ./ something about an invalid command. I'm not sure why its saying this as I'm using ChangeWorking Directory with my path and it work earlier.

I'm assuming this may be to do with the connection? And having 2 of them. Surerly theres a way in the code to set 1 connection so that i can alternate between ASCII and binary?

Any help would be appreciated.

PS... Thanks for the advice last time. Very good!

5 Answers

0 votes
by (162k points)
Just use the one connection. You can change like this in your code:

ftpConnection.TransferType = FTPTransferType.BINARY;
0 votes
by (480 points)
Sorry Bruce but I dont understand.

I understand ftpConnection is my ftp object that is dragged onto the form. But what is FTPTransferType .

WHen i insert this code
ftpConnection.TransferType = FTPTransferType.BINARY;

My program doesnt know what FTPTransfer Type is and think i'm missing an assembly reference or directive (header file ???). If i leave out the FTP bt and just put binary it obviously doesn't know what "BINARY" is.

My Code is:-

ftpASCII.TransferType = FTPTransferType.BINARY;
0 votes
by (51.6k points)
You need to add a using-statement at the top of your file, like this:
using EnterpriseDT.Net.Ftp;


- Hans (EnterpriseDT)
0 votes
by (480 points)
Thanks Guys!

This worked great! I'm still not sure what we have done here though as i'm used to C++ headers and from what I can gather the "using" directive is like a header isn't it?

Anyway thanks alot i'm getting further!
0 votes
by (162k points)
'using' in C# is like 'import' in Java or using a header file in C/C++.

Categories

...