LDAP服务器不可用(Active Directory) [英] LDAP server is unavailable (Active Directory)

查看:946
本文介绍了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();

推荐答案

我终于找到了解决方案。



I finally found the solution.

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

:-)


看起来更多的人有同样的问题,可能是链接 [ ^ ]可以帮助你。
It looks like more people had the same problem, probably one of the links[^] can help you.


看起来更多的人有同样的问题,可能一of 链接 [ ^ ]可以帮助您。
It looks like more people had the same problem, probably one of the links[^] can help you.


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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆