I'm working on an MVC 3 app in .NET, I don't have much experience with LDAP, but I wanted to be able to simply validate if a user exists. I don't need to validate the username and password combo as in this example:
LDAP Authentication in ASP.Net MVC
Although this is almost what I want to do. I just need to validate the username before he/she is added.
Is there a simple way to do this in .NET/MVC
Use the
System.DirectoryServices.AccountManagement
namespace and pass in the username or distinguished name (e.g. CN=John Doe) by altering theIdentityType
enum.You can use LdapConnection and SearchRequest to achive that.
Example to get all users: