c# - How can I connect on my own PC to a local FileZilla FTP server for testings? -


i downloaded filezilla server , installed it.

then use in filezilla address: 127.0.0.1 port: 14147 , admin user name: admin

and connected fine.
want connect server upload download , delete files using c#.

this code. code working fine when used online ftp server @ ipage.com

but want use filezilla.

string fff = ""; public string[] getfilelist() {     string[] downloadfiles;     stringbuilder result = new stringbuilder();     webresponse response = null;     streamreader reader = null;     try     {         ftpwebrequest reqftp;         reqftp = (ftpwebrequest)ftpwebrequest.create(new uri("ftp://" + f.host + "/"));         fff = "ftp://" + f.host + "/";         reqftp.usebinary = true;         reqftp.credentials = new networkcredential(f.username, f.password);         reqftp.method = webrequestmethods.ftp.listdirectory;         reqftp.proxy = null;         reqftp.keepalive = false;         reqftp.usepassive = false;         response = reqftp.getresponse();         reader = new streamreader(response.getresponsestream());         string line = reader.readline();         while (line != null)         {             result.append(line);             result.append("\n");             line = reader.readline();         }         result.remove(result.tostring().lastindexof('\n'), 1);         return result.tostring().split('\n');     }     catch (exception ex)     {         if (reader != null)         {             reader.close();         }         if (response != null)         {             response.close();         }         downloadfiles = null;         return downloadfiles;     } } 

in fff see ftp://127.0.0.1/ , f.username empty "" , f.password admin

then make continue , i'm getting exception:

the remote server returned error: (501) syntax error in parameters or arguments  system.net.webexception caught   hresult=-2146233079   message=the remote server returned error: (501) syntax error in parameters or arguments.   source=system   stacktrace:        @ system.net.ftpwebrequest.checkerror()        @ system.net.ftpwebrequest.syncrequestcallback(object obj)        @ system.io.stream.close()        @ system.net.connectionpool.destroy(pooledstream pooledstream)        @ system.net.connectionpool.putconnection(pooledstream pooledstream, object owningobject, int32 creationtimeout, boolean canreuse)        @ system.net.ftpwebrequest.finishrequeststage(requeststage stage)        @ system.net.ftpwebrequest.getresponse()        @ ftp_progressbar.ftpprogress.getfilelist() in c:\ftp_progressbar\ftp_progressbar\ftpprogress.cs:line 342   innerexception: 

line 342 is:

response = reqftp.getresponse(); 

what want demo ftp server can check c# program on it.

the 501 sent filezilla server due absence of username in user command. cannot login ftp server without providing username.

you have login ftp account server. cannot login administrative password.

in filezilla server interface, go menu edit > users, create ftp user, , use it's username/password in code.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -