Lelezeus
Lelezeus

Reputation: 498

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

I have an ASP MVC4 site. I have to create a folder on ftp server and I use this code:

FtpWebRequest ftpWebRequest = (FtpWebRequest)WebRequest.Create("ftp://mysite.altervista.org/newfolder");
ftpWebRequest.Method = WebRequestMethods.Ftp.MakeDirectory;       
ftpWebRequest.UsePassive = true;
ftpWebRequest.EnableSsl = true;
ftpWebRequest.Credentials = new NetworkCredential("userTest", "psw123456");
ftpWebRequest.KeepAlive = true;
ftpWebRequest.UseBinary = true;
using (var resp = (FtpWebResponse)ftpWebRequest.GetResponse())
 {
  Console.WriteLine("Result: " + resp.StatusCode);
 }

When I run my site in localhost everything works fine, but when I Publish my site to Azure Website, it returns me an exception: "The remote server returned an error: (530) Not logged in." I think that the problem is not in my code, do I have to change some setting in Azure?

Thank you in advance

Upvotes: 2

Views: 1759

Answers (2)

spaghettifunk
spaghettifunk

Reputation: 2014

Have tried to check some settings in your FTP server? Maybe, the incoming connections are blocked.

Upvotes: 0

Neel
Neel

Reputation: 11741

remove below 2 lines and try again

ftpWebRequest.UsePassive = true;
ftpWebRequest.EnableSsl = true;

Upvotes: 1

Related Questions