如何使用用户名和密码在LDAP中检索EmployeeID [英] How to retrive the EmployeeID in LDAP using the Username and Password
本文介绍了如何使用用户名和密码在LDAP中检索EmployeeID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,
我可以通过LDAP使用以下代码对用户进行身份验证。任何人都可以建议我如何撤销相应用户名的用户ID。我想知道如何查询LDAP以检索相应用户名的UserID。
Hello,
I am able to authenticate the users using the following code through LDAP. Can anyone please suggest me how to retieve the User Id for the corresponding Username. I wanted to kow how can we query LDAP to retrieve the UserID for the coresponding Username.
try
{
LdapConnection connection = new LdapConnection("myserver.mycompany.com");
NetworkCredential credential = new NetworkCredential(textBoxUsername.Text, passwordBox.Password);
connection.Credential = credential;
connection.Bind();
AddData admin = new AddData();
admin.Show();
this.Close();
}
catch (LdapException lexc)
{
String error = lexc.ServerErrorMessage;
MessageBox.Show("User Authentication Failed! Please Try again.");
}
catch (Exception exc)
{
MessageBox.Show(Convert.ToString(exc));
}
推荐答案
SELECT userid,来自TableName的用户名
SELECT userid, username from TableName
这篇关于如何使用用户名和密码在LDAP中检索EmployeeID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文