title: How can I check a user/password combination on an ActiveDirectory without putting the password in a String?
body: <p>I want to check User/Password combination on a Windows domain. Right now I do it with the following code:</p>
  
  <pre><code>bool Login(String username, String password) {
      var principalContext = new PrincipalContext(ContextType.Domain);
      principalContext.ValidateCredentials(username, password);
  }
  </code></pre>
  
  <p>While it works, the thing that bugs me is that I have to put the password in a <code>String</code> in order to use that API; as I am using a <code>SecureString</code> to store the password everywhere else, I would really like to use some way of checking the username / password combination without having to pass the password as a managed <code>System.String</code>.</p>
  
  <p>What would be the best way of achieving that?</p>