2014-06-11 64 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); 
相关问题