I have C# code to talk to an FTP server which has authentication disabled (takes any username and password):
Stream responseStream = null;
FtpWebRequest request = WebRequest.Create("ftp://" + at.IP + "/" + destFilePath) as FtpWebRequest;
request.Method = WebRequestMethods.Ftp.DeleteFile;
request.GetResponse();
responseStream.Close();
When I run this code in Windows without Mono, it works. When I run it in unix using mono appName.exe
, it works. But when I create a C++ application, load the .dll
file into MonoDomain and then try to call it I get this (.NET v2.0.50727, MONO 2.6.4):
System.Net.WebException: Server returned an error: 530-User Access denied.
530-
530-Usage: USER username@hostname
530 PASS userpassword
at System.Net.FtpWebRequest.A开发者_如何转开发uthenticate () [0x00000] in <filename unknown>:0
at System.Net.FtpWebRequest.OpenControlConnection () [0x00000] in <filename unknown>:0
at System.Net.FtpWebRequest.ProcessMethod () [0x00000] in <filename unknown>:0
at System.Net.FtpWebRequest.ProcessRequest () [0x00000] in <filename unknown>:0
What is going on? The FTP server is accessible from Windows and unix command lines.
Even if a FTP server says its open, you often have to login with anonymous@anonymous.com or something simular to this.
精彩评论