사용자가 Active Directory에서 유효한지 여부를 확인하기 위해 사용자 이름과 암호를 전달합니다. 유효한 사용자의 암호가 활성 디렉토리와 일치하는지 확인하는 방법
private bool ValidUser(string name, string userPwd)
{
string UserName = "XXXXXXXXXX";
string Password = "XXXXXXXXXXXXX";
DirectoryEntry objRootEntry = new DirectoryEntry("XXXXXXXX.com", UserName, Password);
DirectorySearcher objADSearcher = new DirectorySearcher(objRootEntry);
objADSearcher.Filter = ("(&(sAMAccountType=xxxxxxxxx)(samAccountName=" + name + "))");
SearchResult objResult = objADSearcher.FindOne();
DirectoryEntry objLoginEntry = (objResult != null) ? objResult.GetDirectoryEntry() : null;
if (objLoginEntry != null)
{
return true;
}
return false;
}
가 지금은 혼자 선이 입력 한 암호 (userPwd)는 Active Directory와 일치하는지 여부를 확인하는 데 필요한 사용자 이름을 확인 :
여기 내 코드입니다. 그렇게하는 방법.
도와주세요.
가능한 중복 (http://stackoverflow.com/questions/400872/active-directory- check-username-password) –
.Net의 버전은 무엇입니까? – jww
메신저 사용 .net 4 – Mythily