Last post Jan 06, 2011 05:02 AM by smirnov
Sep 30, 2010 07:06 AM|teejaymt|LINK
I like to add a field that add active directory user in ASP.NET Web Application .
Thanks in Advance
ASP.Net VS SharePoint
Jan 06, 2011 05:02 AM|smirnov|LINK
To add a directory user you need to specify userid "corp1\johndoe" or just "johndoe" if domain is always the same. If you mean you want to have a list of users, or you would need to have a validation of entered userid, then you need to write a custom function
A code to validate entered user id could be similar to
DirectoryEntry de = new DirectoryEntry("LDAP://DC=corp,DC=net");
DirectorySearcher ds = new DirectorySearcher(de);
ds.SearchScope = SearchScope.Subtree;
ds.Filter = "(&(objectClass=User)(sAMAccountName=johndoe))";
if (ds.FindOne() == null)
// User not found!