To achieve checking for if a user exists. You can use
PrincipalContext to authenticate user credentials,
public bool DoesUserExist(string userName)
{
using (var domainContext = new PrincipalContext(ContextType.Domain, "DOMAIN"))
{
using (var foundUser = UserPrincipal.FindByIdentity(domainContext, IdentityType.SamAccountName, userName))
{
return foundUser != null;
}
}
}
Moreover, you can also check relevant topics about
user existed in Active Directory asp.net online, more examples are available for you.
Best regards
Angie
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Member
438 Points
606 Posts
Active Directory and VB.NET
Dec 19, 2013 12:43 PM|mnmhemaj|LINK
How to check if a user is in a Distribution Group (Not windows security group) in the Active Directory?
All-Star
32817 Points
3815 Posts
Re: Active Directory and VB.NET
Dec 26, 2013 12:30 AM|Angie xu - MSFT|LINK
HI mnmhemaj
To achieve checking for if a user exists. You can use PrincipalContext to authenticate user credentials,
Moreover, you can also check relevant topics about user existed in Active Directory asp.net online, more examples are available for you.
Best regards
Angie
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.