//TODO: Rename method accc to what it does public LDAPUser AuthenticateUserWithLdap(UserCredential userCredential) { var ldapAuthentication = new LDAPAuthentication() { DomainName = ConfigurationManager.AppSettings["Domain"], UserName = userCredential.Username, Password = userCredential.Password }; _logMessages.AppendFormat("Performing LDAP logon for user {0} with domain {1}", ldapAuthentication.UserName, ldapAuthentication.DomainName); LDAPUser response = null; try { response = _ldapAuthenticationService.IsAuthenticated(ldapAuthentication); _logMessages.Append("Successfully invoked ldap service. Response received"); } catch (Exception ex) { _logMessages.AppendFormat("An Error occurred invoking ldap authentication. Exception details {0}", ex.Message); Elmah.ErrorLog.GetDefault(null).Log(new Elmah.Error(ex)); } _logger.Info(_logMessages.ToString()); return(response); }