Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. {
  2. using (PrincipalContext ctx = new PrincipalContext(ContextType.Domain, {{domainName}}, {{myUserName}}, {{MyPassword}}))
  3. {
  4. var valid = ctx.ValidateCredentials({{givenUsername}}, {{givenPassword}});
  5. if (!valid)
  6. throw new Exception("Username or Password are incorrect");
  7. using (UserPrincipal qbeUser = UserPrincipal.FindByIdentity(ctx, username.ToLower()))
  8. {
  9. //stuff
  10. }
  11. }
  12. }```
  13.  
  14. expected results would be that the users from both groups are able to log in
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement