Tech Off Post

Single Post Permalink

View Thread: FTP Port
  • User profile image
    Ion Todirel

    Hey guys,

    i have a problem with FTP Classes in .NET Framework 2.0 BCL.

    This code will work if FTP server is set with default port 21, but if is not, then... will not work:

    FtpWebRequest request = WebRequest.Create(Uri) as FtpWebRequest;

    request
    .Credentials = new
    NetworkCredential("John Todirel", "home");
    request
    .Method = WebRequestMethods.Ftp.
    RemoveDirectory;

    FtpWebResponse response = request.GetResponse() as FtpWebResponse;
    MessageBox.Show(response.
    StatusDescription);

    response.Close();

    so how to change FTP Port? any ideas?