private static bool checkvaliduser(string strADLoginName)
{
bool userExists = false;
using (PrincipalContext context = new PrincipalContext(ContextType.Domain, "hgrp", "DC=hgrp,DC=com,DC=sg"))
{
using (UserPrincipal user = UserPrincipal.FindByIdentity(context, strADLoginName))
{
userExists = (user != null);
}
}
return userExists;
}
No comments:
Post a Comment