title: Generic Authentication Call to Active Directory in C#
body: <p>I would like to have a clean C# class that authenticates from Active Directory. </p>
  
  <p>It should be pretty simple, it just has to ask for credentials and check if it matches what AD is expecting.</p>
  
  <p>I am responsible for a number of C# applications, and I would like all of them to use the same class. </p>
  
  <p>Could someone please provide a clean code sample of such a class? It should have good error handling, be well commented, and specifically ask for credentials rather than try to read if a user is already logged in to AD for another application. (This is a security requirement because some applications are used in areas with shared computers: People with multiple roles and different permission levels may use the same computer and forget to log out between sessions)</p>