Joe Ruder
Joe Ruder

Reputation: 2194

Getting a error 530 Not logged in when connecting using FtpWebRequest

I have tried about everything I can think of. I am trying to get a directory listing from a FTP server. I am able to login and list/download from FileZilla.

My password looks like this (letters changed):

c0dlWTRBOZc=

I have tried using Normalize() and not using it.

It errors on the GetResponse() line.

Here is the code:

FtpWebRequest request = (FtpWebRequest)WebRequest.Create(thisConnection.remoteFTP_URI);
request.KeepAlive = true;
request.UsePassive = true;
request.UseBinary = true;
request.Method = WebRequestMethods.Ftp.ListDirectory;
request.Credentials = new NetworkCredential(thisConnection.userName.Normalize(),thisConnection.passWord.Normalize());
FtpWebResponse response = (FtpWebResponse)request.GetResponse();

I am using this exact same code for other FTP servers with no issues. I don't have direct control over the server so changing password or other server setting would be problematic.

Thank you for any help!

Upvotes: 1

Views: 3443

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202088

Your password string looks like base64-encoded.

What is actually the form used by FileZilla in its configuration file (sitemanager.xml).

So my guess is that you have copied the encoded password from the sitemanager.xml and you try to use it as a literal password in the FtpWebRequest.

Make sure you use the actual literal password. If you do not remember it, use some base64 decoder.
You will find plenty of them online.

Upvotes: 1

Related Questions