窗体身份验证对Active Directory - LDAP协议 [英] Forms Authentication against Active Directory - LDAP Protocol

查看:198
本文介绍了窗体身份验证对Active Directory - LDAP协议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建一个网页,对现有的Active Directory用户进行身份验证。域名实际上是一个云计算配置,其中有堆栈上的域控制器和多个其他服务器。

I need to create a web page that authenticates users against an existing active directory. The domain is actually a cloud computing configuration where there is a domain controller and multiple other servers on the stack.

据我所知,可用于从System.DirectoryServices命名空间的对象。不过,我似乎无法路径code到Active Directory通过LDAP://domain.com 地址。目前似乎没有任何的沟通正在进行。我怀疑有一些初始配置必要或安全措施阻止通信。

I understand that objects from the System.DirectoryServices namespace can be used. However, I cant seem to path the code to the active directory through the LDAP://domain.com address. There doesnt seem to be any communication going on. I suspect there is some initial configuration necessary or security measures blocking the communication.

我用这个例子从MSDN工作: http://msdn.microsoft.com/en-us/library/ms180890(v=vs.80).aspx

I am working with this example from MSDN: http://msdn.microsoft.com/en-us/library/ms180890(v=vs.80).aspx.

我得到一个错误,指出该服务器不可操作。

I get an error that says the server is not operational.

推荐答案

看看这个链接(取代旧有web.archive.org):

Take a look at this link (replaced old one with web.archive.org):

<一个href="http://web.archive.org/web/20110317102802/http://www.$c$cproject.com/KB/system/everythingInAD.aspx"相对=nofollow> HTTP://www.$c$cproject.com/KB/system/everythingInAD.aspx#35

这是如何得到默认项:

try
{
    System.DirectoryServices.DirectoryEntry AdRootDSE = new System.DirectoryServices.DirectoryEntry("LDAP://rootDSE");
    string rootdse = System.Convert.ToString(AdRootDSE.Properties["defaultNamingContext"].Value);

    if (!rootdse.StartsWith("LDAP://", StringComparison.OrdinalIgnoreCase) && !rootdse.StartsWith("LDAPS://", StringComparison.OrdinalIgnoreCase))
    {
        rootdse = "LDAP://" + rootdse;
    }

    return rootdse;
}
catch (Exception ex)
{
}

这篇关于窗体身份验证对Active Directory - LDAP协议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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