LDAP認証を実行できるモジュールを作成するのに問題があります。
ブラウザに次の行を入力してEnterキーを押すと、Windows連絡先アプリケーションがサーバーからのレコードを表示するので、これが接続する正しい場所であることがわかります。
ldap://directory.abc.edu/uid=asmith,ou=People,o=abc.edu
しかし、同じことをコードで使用したい場合、「無効なdn構文」エラーメッセージが表示されます。
これが私のコードです:
public void LDAPResult()
{
using (DirectoryEntry root = new DirectoryEntry(string.Format(@"LDAP://directory.abc.edu/uid=asmith,ou=People,o=abc.edu")))
{
using (DirectorySearcher searcher = new DirectorySearcher(root))
{
//This following line give me the error
**SearchResultCollection results = searcher.FindAll();**
//The rest is not actually important, I never get there to see if it works properly.
StringBuilder summary = new StringBuilder();
foreach (SearchResult result in results)
{
foreach (string propName in result.Properties.PropertyNames)
{
foreach (string s in result.Properties[propName])
{
summary.Append(" " + propName + ": " + s + "\r\n");
}
}
summary.Append("\r\n");
}
Console.WriteLine(summary);
}
}
}
これに関するどんな助けもとても高く評価されます。ありがとう、