title: ftp process won't close (c#)
body: <p><strong>EDIT 3: <a href="https://stackoverflow.com/questions/31026522/use-ftp-exe-with-c-sharp/31044015#31044015">The solution</a></strong></p>
  
  <p><strong>EDIT 2: Could <code>myProcess.WaitForInputIdle();</code> help?</strong></p>
  
  <p><strong>EDIT: I just found out that the files weren't even downloaded.
  I just forgott to delete the old ones. Please help :/</strong></p>
  
  <p>so I use this code to download a file from an ftp server:</p>
  
  <pre><code>Process p = new Process();
  ProcessStartInfo info = new ProcessStartInfo();
  info.WindowStyle = ProcessWindowStyle.Hidden;
  info.FileName = "ftp.exe";
  info.RedirectStandardInput = true;
  info.UseShellExecute = false;
  
  p.StartInfo = info;
  p.Start();
  
  using (StreamWriter sw = p.StandardInput)
  {
     if (sw.BaseStream.CanWrite)
     {
        sw.WriteLine("open " + folder.server);
        sw.WriteLine(folder.cred.user);
        sw.WriteLine(folder.cred.password);
        sw.WriteLine("get " + file);
        sw.WriteLine("close");
        sw.WriteLine("quit");
     }
  }
  </code></pre>
  
  <p>It works perfectly fine, but at the end I get a console output saying something like <code>User (*server*:(none)): Password:</code> and I have to enter something so my program continues.</p>
  
  <p>However, what ever I enter I get the response:</p>
  
  <pre><code>User anonymous cannot log in.
  </code></pre>
  
  <p>Does anybody know how I can avoid that?</p>
  
  <p>I also tried skipping it, but nor <code>sw.WriteLine(" ");</code> neither <code>p.Close()</code> seem to work.</p>
  
  <p>What can I do?</p>