I connect with FTP using following code.
// Get the object used to communicate with the server.
FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://ftp.mydomain.com/websitefolder/downloadfiles/");
request.Method = WebRequestMethods.Ftp.ListDirectoryDetails;
// This example assumes the FTP site uses anonymous logon.
request.Credentials = new NetworkCredential("myuser", "********");
FtpWebResponse response = (FtpWebResponse)request.GetResponse();
Now, I want to set port number but I don't get any property to set port number. Is it possible to set port number using FtpWebRequest
? If so, can anybody suggest me?
If it is not possible to set port number. which port number use by FtpWebRequest
to connect with FTP?
Updated: I am talking about port number 21 and 22. Please guide.