Firewall and FTP Directory Listing in C# -



Firewall and FTP Directory Listing in C# -

i trying directory listing of ftp site having issues connecting , retrieving listing. believe problem windows firewall windows 2008 server r2. here code:

seek { // object used communicate server. ftpwebrequest request = (ftpwebrequest)webrequest.create("ftp://127.0.0.1"); request.method = webrequestmethods.ftp.listdirectorydetails; request.usepassive = false; // illustration assumes ftp site uses anonymous logon. request.credentials = new networkcredential("user", "pass"); request.proxy = httpwebrequest.defaultwebproxy; ftpwebresponse response = (ftpwebresponse)request.getresponse(); stream responsestream = response.getresponsestream(); streamreader reader = new streamreader(responsestream); label1.text = reader.readtoend(); reader.close(); response.close(); } grab (exception ex) { label1.text = ex.message; }

i wondering firewall settings or ports need opened allow action happen. enabled incoming/outgoing traffic on ports 21 , 20 , didn't work allowed traffic incoming/outgoing ports , worked. however, opening every port not viable solution :)

i don't think suited stackoverflow, because question moreso pertains security configuration windows server 2008 r2. but, in light, tested code, , works fine, need create windows firewall exception ftp access on server required ftp ports. otherwise, windows firewall indeed block incoming connections client. if opening firewall exception not prepare issue want investigate other security configuration concerns on server.

c# ftp firewall

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -