2014-06-11 109 views
0

如何使用asp.net中的應用程序池標識將AD連接到LDAPConnection。使用應用程序池標識的LDAP連接

應用程序正在使用LDAP連接從AD加載用戶詳細信息。與AD連接的當前用戶名和密碼存儲在web.config中,我們使用的是下面的代碼與AD

// Create an LDAP connection to the server 
LdapConnection connection = new LdapConnection(ldapServerName); 
NetworkCredential networkCredential = new NetworkCredential(userName, password, domainName); 
connection.Bind(networkCredential); 

而是連接使用證書從web.config中的我怎麼使用ASP.Net應用程序池標識用於連接AD?

回答

1

使用System.Net.CredentialCache.DefaultNetworkCredentials

LdapConnection connection = new LdapConnection(ldapServerName); 
connection.SessionOptions.Sealing = true; // Using Kerberos 
connection.SessionOptions.Signing = true; // Using Kerberos 
connection.Bind(CredentialCache.DefaultNetworkCredentials); 
相關問題