title: FTP Connection Failing "Unable to connect to the remote server"
body: <p>I am trying to connect to an FTP server to upload a file.  I am getting the "
  Unable to connect" error.  If I use command line and open an FTP connection, I am able to connect. Not sure why I get error when connecting programatically.  Any help will surely be appreciated.  </p>
  
  <pre><code> FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://1.23.84.2");
   request.Method = WebRequestMethods.Ftp.UploadFile;                   
  
   request.Credentials = new NetworkCredential("user","password");
  
   // Copy the contents of the file to the request stream.    
   StreamReader sourceStream = new StreamReader(path);
   byte[] fileContents = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd());
   sourceStream.Close();
   request.ContentLength = fileContents.Length;
  
   Stream requestStream = request.GetRequestStream();
   requestStream.Write(fileContents, 0, fileContents.Length);
   requestStream.Close();
  
   FtpWebResponse response = (FtpWebResponse)request.GetResponse();
  
   Console.WriteLine("Upload File Complete, status {0}", 
            response.StatusDescription);
  
   response.Close();
  </code></pre>