title: C# - FTP check/test server
body: <p>I want to test a given IP and login detail to see whether the FTP server is active/details are correct.  Nothing more.  </p>
  
  <p>I have looked on the web for a solution but none seem simple/eloquent as, for example, using the Ping class to ping and check for a server. I have the following, which doesn't work:</p>
  
  <pre><code>    static private void testConntecion()
      {
          FtpWebRequest requestDir = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://172.29.200.158/"));
          requestDir.Credentials = new NetworkCredential("dvm_user", "dvm");
  
          try
          {
              FtpWebResponse response = (FtpWebResponse)requestDir.GetResponse();
              Console.WriteLine("Cool Beans");
          }
  
          catch(Exception ex)
          {
              Console.WriteLine(ex);
          }
      }
  </code></pre>
  
  <p>I have also tried:</p>
  
  <pre><code>FtpWebRequest requestDir = (FtpWebRequest)FtpWebRequest.Create("ftp://172.29.200.158/");
  </code></pre>
  
  <p>Error message: System.Net.WebException: The requested URI is invalid for this FTP command. at System.Net.FtpWebRequest.GetResponse()</p>
  
  <p>Thanks in advance.</p>