title: Can't read StandardOutput when calling wkhtmltopdf with a ProcessInfo UserName and Password
body: <p>I've used wkhtmltopdf successfully before but now I have a scenario were I need to use a specific account when starting the process. When I set a valid username/pwd the standardoutput stream is empty and the return code is -1. As soon as I comment out the username/pwd it works as expected. </p>
  
  <p>Testing this in .Net 4, Win 7 64 bit.</p>
  
  <pre><code>class Program
  {
      static void Main(string[] args)
      {
          var wkhtmlDir = AppDomain.CurrentDomain.BaseDirectory;
          var wkhtml = wkhtmlDir + @"\wkhtmltopdf.exe";
  
          var info = new ProcessStartInfo(wkhtml);
  
          info.CreateNoWindow = true;
          info.RedirectStandardOutput = true;
          info.RedirectStandardError = true;
          info.RedirectStandardInput = true;
          info.UseShellExecute = false;
          info.WorkingDirectory = wkhtmlDir;
  
          info.Arguments = "http://www.google.com -";
  
          var securePassword = new SecureString();
          var password = "mypassword";
  
          foreach (var c in password)
          {
              securePassword.AppendChar(c);
          }
  
          //comment out next three lines, and it works!
          info.UserName = "myuser"; 
          info.Password = securePassword;
          info.Domain = "mydomain"; 
  
          using (var process = Process.Start(info))
          {
              var output = process.StandardOutput.ReadToEnd();
  
              // wait or exit
              process.WaitForExit(60000);
  
              var returnCode = process.ExitCode;
          }
  
      }
  </code></pre>
  
  <p>If I comment out the info.UserName, Password, Domain, output has data, otherwise if I try using credentials, output is blank and the returnCode is -1.</p>
  
  <p>Hoping others have run into this, seems like a common scenario, am sure missing something simple...</p>
  
  <p>Thanks for any help!!</p>