我有一个登录页面,我需要用户通过检查用户名来登录而不知道用户所在的域名。
String adPath = "LDAP://domain";
LdapAuthentication adAuth = new LdapAuthentication(adPath);
if (true == adAuth.IsAuthenticated(domain, username, Password))
{
// something to do
}
如何根据用户动态更改域路径?
答案 0 :(得分:1)
添加条件以在检查用户名
后更改adAuth string adPath = "LDAP://domain";
string anotheradPath = "LDAP://seconddomain";
if (username== "something" )
{
adAuth = new LdapAuthentication(adPath );
}
else
{
adAuth = new LdapAuthentication(anotheradPath );
}