FTP Problem

I am trying to login to an FTP server, to download a file. Every time I try, I get the following message:

"The remote server returned an error: (530) Not logged in."

I can login and download the file using DOS FTP, and CuteFTP from this server without a problem. I also changed the code to reflect a different server, and that worked fine. When I login to the server, it identifies itself as "Microsoft FTP Service".

Can anyone point me in the right direction? Below is my code:

request = (FtpWebRequest)FtpWebRequest.Create(fileName);
request.Credentials = new NetworkCredential(userName, passWord);
request.KeepAlive = false;
request.UseBinary = false;
request.UsePassive = false;
request.Method = WebRequestMethods.Ftp.DownloadFile;
response = (FtpWebResponse)request.GetResponse();

using (reader = new StreamReader(response.GetResponseStream()))
{
string streamContent = reader.ReadToEnd();
//Console.WriteLine(streamContent);
writer = new StreamWriter(fileName, true);
writer.Write(streamContent);
writer.Close();
}

Thanks,
Russ

[1163 byte] By [RussPerna] at [2007-12-25]
# 1

Hmm, what happens if you use the default values: i.e. comment the KeepAlive, UseBinary and UsePassive lines?

Mariya

MariyaAtanasova-MSFT at 2007-8-31 > top of Msdn Tech,.NET Development,.NET Framework Networking and Communication...
# 2

The same thing happens. Originally I didn't have them in there, but I put them in to hopefully resolve the issue. It didn't work though.

Thanks,
Russ

RussPerna at 2007-8-31 > top of Msdn Tech,.NET Development,.NET Framework Networking and Communication...
# 3

I can't get this to work no matter what I do. I have looked for the error online, and very few people have the same one. I've also tried changing most of the properties from their defaults with no luck.

However, it works on every other site that I have tried it on.

Thanks,
Russ

RussPerna at 2007-8-31 > top of Msdn Tech,.NET Development,.NET Framework Networking and Communication...
# 4

Is this ftp server accessible from outside?

Can you get a System.NetTrace log and a network sniff from your machine so I can see what is going on the wire.

Here are instructions on how to get a sniff with Netmon: http://blogs.msdn.com/dgorti/archive/2005/10/29/486887.aspx
and a trace log file: http://blogs.msdn.com/dgorti/archive/2005/09/18/471003.aspx

Mariya

MariyaAtanasova-MSFT at 2007-8-31 > top of Msdn Tech,.NET Development,.NET Framework Networking and Communication...
# 5

After installing and running netmon, I finally found the problem. The password contained a "\" character, and I never thought to change it to "\\". It wasn't until I saw that it was sending it incorrectly that I realized the issue.

Thanks for all your help with this,
Russ

RussPerna at 2007-8-31 > top of Msdn Tech,.NET Development,.NET Framework Networking and Communication...

.NET Development

Site Classified