本文介绍了LDAP服务器不可用(Active Directory)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试从Active Directory获取信息并将其显示在文本框中。

从localhost运行它确实有效但当我将它托管到服务器并运行它时,它会给我这个错误LDAP服务器不可用



这是我的代码



m trying to take information from the Active Directory and display it to text box.
When am running it from localhost it does work but when i host it to a server and run it, it give me this error "LDAP server is unavailable"

Here is my code

Session["name"] = txtnameuser2nd.Text;

        PrincipalContext context = new PrincipalContext(ContextType.Domain, "NMMU");
        UserPrincipal user = UserPrincipal.FindByIdentity(context, Session["name"].ToString());
        txtname2nd.Text = user.GivenName.ToString();
        txtlastname2nd.Text = user.Surname.ToString();

推荐答案

Session["name"] = txtnameuser2nd.Text;

        PrincipalContext context = new PrincipalContext(ContextType.Domain, "nmmu.ac.za");
        UserPrincipal user = UserPrincipal.FindByIdentity(context, Session["name"].ToString());
        txtname2nd.Text = user.GivenName.ToString();
        txtlastname2nd.Text = user.Surname.ToString();





i ddnt为用户提供对域服务器的完全访问权限,所以我通过包含域服务器的正确名称解决了它。 nmmu.ac.za而不是nmmu。 nmmu没有完全定义



: - )



i ddnt give the user full access to the domain server, so i solved it by including the correct name of the domain server. nmmu.ac.za instead of nmmu. nmmu was not fully defined

:-)




这篇关于LDAP服务器不可用(Active Directory)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 01:54