Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
9.1k views
in .NET FTP by (160 points)
This is the code I have:

var ftp = new FTPConnection;
{
set address, username, password, ACTIVE mode (not showing for security reasons
}

ftp.Connect();

On that last line I get an error "Login with USER first (code =503)"

I can't even connect let alone issue a login command. This is my first time using FTP with this company.

Using C# for .NET 4.5

4 Answers

0 votes
by (162k points)
Please enable logging and post the log file (suitably edited to remove the hostname etc)
0 votes
by (160 points)
Please enable logging and post the log file (suitably edited to remove the hostname etc)



INFO [BaseSocket] 24 Mar 2014 09:07:35.608 : Connecting to 12.169.193.146:21 with timeout 120000 ms
INFO [FTPControlSocket] 24 Mar 2014 09:07:35.810 : Command encoding=System.Text.SBCSCodePageEncoding
INFO [FTPControlSocket] 24 Mar 2014 09:07:35.857 : Expected reply codes = [230,202,332] (strict=False)
DEBUG [FTPConnection] 24 Mar 2014 09:08:53.040 : Set LocalDirectory='C:\Users\bwhite\AppData\Local\Temporary Projects\BBTTransmit\bin\Debug'
DEBUG [FTPClient] 24 Mar 2014 09:08:53.040 : Connecting to 12.169.193.146:21
DEBUG [HostNameResolver] 24 Mar 2014 09:08:53.040 : Resolving 12.169.193.146
DEBUG [HostNameResolver] 24 Mar 2014 09:08:53.040 : 12.169.193.146 resolved to 12.169.193.146
INFO [BaseSocket] 24 Mar 2014 09:08:53.040 : Connecting to 12.169.193.146:21 with timeout 120000 ms
DEBUG [BaseSocket] 24 Mar 2014 09:08:53.071 : Successfully connected to 12.169.193.146:21
DEBUG [FTPControlSocket] 24 Mar 2014 09:08:53.087 : Setting socket timeout=120000
INFO [FTPControlSocket] 24 Mar 2014 09:08:53.087 : Command encoding=System.Text.SBCSCodePageEncoding
DEBUG [FTPControlSocket] 24 Mar 2014 09:08:53.087 : StrictReturnCodes=False
DEBUG [FTPControlSocket] 24 Mar 2014 09:08:53.103 : 220 (vsFTPd 2.0.1)
DEBUG [FTPConnection] 24 Mar 2014 09:08:53.103 : Connected to 12.169.193.146 (instance=0)
DEBUG [FTPControlSocket] 24 Mar 2014 09:08:53.103 : ---> USER ******
DEBUG [FTPControlSocket] 24 Mar 2014 09:08:53.134 : 331 Non-anonymous sessions must use encryption.
DEBUG [FTPControlSocket] 24 Mar 2014 09:08:53.134 : ---> PASS ********
DEBUG [FTPControlSocket] 24 Mar 2014 09:08:53.165 : 503 Login with USER first.
INFO [FTPControlSocket] 24 Mar 2014 09:08:53.165 : Expected reply codes = [230,202,332] (strict=False)


(I also *'ed out the user name)
0 votes
by (162k points)
Interesting. It is telling you to use "USER" first, and yet the log shows that you are.

The clue may be in this message: "Non-anonymous sessions must use encryption".

That may mean you need to be using FTPS (FTP over SSL) rather than FTP.

You can confirm that by using FIlezilla to connect - first try FTP then FTPS (explicit).
0 votes
by (51.6k points)
It certainly appears that you have to use FTPS in order to log into a user account. Our commercial version of the library, edtFTPnet/PRO contains a component, SecureFTPConnection, that allows you to set the protocol to FTPSExplicit, which should allow you to log in.

- Hans (EnterpriseDT)

Categories

...