ADAMインスタンスをセットアップしてテストユーザーを追加しました。私はWindowsアカウントを使用してADAMにバインドできますが、ADAMユーザーのいずれかを使用してバインドすることはできません。 (私は正常にldpのadamユーザーをバインドできます)& msDS-UserAccountDisabled属性をfalseに設定して、ユーザーが有効になっていることを確認しました。C#からADAMに対してADAMユーザーを認証する - バインドできません
エラー:システム 私は私の窓に結合し、私は成功し、私はエラーを取得する&は、ADAMユーザーのプロパティを戻すが、私がしようとしたとき、私はまだ、それらを認証するために苦労していますし、ADAMユーザーアカウントにバインドする検索することができますアカウント.Runtime.InteropServices.COMException(0x8007052E):ログオンに失敗しました:不明なユーザー名またはパスワードが間違っています。 System.DirectoryServices.DirectoryEntry.Bind(ブールthrowIfFail)
でここで私が使用していますコードです:任意の助けを事前に
string userName = txtUserName.Text;
string password = txtPassword.Text;
string ADConnectionString = "LDAP://localhost:389/CN=sandbox,DC=ITOrg";
DirectoryEntry entry = new DirectoryEntry(ADConnectionString);
entry.Username = "myComputer\\Administrator";
entry.Password = "myPassword";
try
{
DirectorySearcher searcher = new DirectorySearcher(entry);
searcher.Filter = "(&(objectClass=user)(CN=" + userName + "))";
SearchResultCollection result = searcher.FindAll();
if (result.Count > 0)
{
//bind with simple bind
using (DirectoryEntry de = new DirectoryEntry(result[0].Path, userName, password,AuthenticationTypes.None))
{
if (de.Guid != null) // this is the line where it dies
{
Label1.Text = "Successfully authenticated";
Label2.Text = result[0].Properties["displayName"][0].ToString();
Label3.Text = result[0].Properties["telephoneNumber"][0].ToString();
} else
{
Lable1.Text = "Unable to Authenticate";
}
}
}
else
{
Lable1.Text = "UserName :" + userName + " not found";
}
} catch(Exception ex)
{
Label1.Text = "Error searching: " + ex.ToString();
}
おかげで、感謝!
Stackoverflowへようこそ、Joe!すべてのADAMとActive Directoryの照会担当者は、こちらの質問に目を留めていることを知ってうれしいです! ;-) –
私は同じ問題があります。ユーザーの属性からUPNを削除すると、認証は常に失敗します。とにかくUPNなしで認証することはありますか? –