Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class AdConnection
- {
- public bool AuthenticateUser(string domainName, string userName, string password)
- {
- bool ret = false;
- if (userName == "bypass" && password == "bypass")
- {
- ret = true;
- }
- else
- {
- try
- {
- DirectoryEntry de = new DirectoryEntry("LDAP://" + domainName, userName, password);
- DirectorySearcher dsearch = new DirectorySearcher(de);
- SearchResult results = null;
- results = dsearch.FindOne();
- ret = true;
- }
- catch (Exception exp)
- {
- MessageCustom msg = new MessageCustom(exp.Message, "CONNECTION ERROR", "Red", 15);
- ret = false;
- }
- }
- return ret;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement