Tag: ldap

使用LDAP连接到Active Directory的连接字符串

我的系统管理员给了我这个: 域名:capp.net USER:capp \ dhr2 通过:admin @ 12345 连接字符串是什么? 我对adfs非常新。 所以我试过这个: 我总是收到此错误:无法与服务器建立安全连接 我对连接字符串做错了。 我只是不知道如何解决它。

.Net中的LDAP目录条目 – 不适用于OU =用户

我有以下代码(C#): (调来自: http ://www.eggheadcafe.com/conversation.aspx?smessidid = 31766061&threadid = 31766050) DirectorySearcher dseSearcher = new DirectorySearcher(); string rootDSE = dseSearcher.SearchRoot.Path; DirectoryEntry rootDE = new DirectoryEntry(rootDSE); string userDSE = rootDSE.Insert(7, “OU=Users,”); DirectoryEntry userDE = new DirectoryEntry(userDSE); rootDSE是正确创建的,但是,如果我尝试使用它,则用户userDSE不可用并抛出“服务器上没有此类对象”exception。 LDAP字符串如下: Root:LDAP:// DC =公司,DC =本地 用户:LDAP:// OU =用户,DC =公司,DC =本地 我作为管理员在Vista上运行,但也需要在XP(管理员)上工作。 我是LDAP和目录管理的新手,所以我在这里黑暗中磕磕绊绊。 有什么想法吗? 此外 – 任何链接的文章,可以让我了解它如何工作将不胜感激。

如何在C#中转义字符串,以便在LDAP查询中使用

我有一个LDAP查询,我用它来在C#中执行搜索。 它使用两个字符串变量(用户名和域),出于安全原因需要对其进行转义。 我该怎么逃避弦乐? C#.NET中是否有可用的function来执行此操作? 示例LDAP搜索条件: (objectCategory=person) (userprincipalname=username@domain*) (samaccountname=username) C#中的LDAP查询字符串示例: string search = “(&(&(objectCategory=person)(userprincipalname=” + username + “@” + domain + “*)(samaccountname=” + username + “)))”; 编辑:我已经有LDAP查询工作,并返回结果。 我想要的只是逃避参数。

列出所有Active Directory组

以下代码列出了一些(但不是全部)Active Directory组。 为什么? 我正在尝试列出所有安全组,通讯组,计算机组等。我是否指定了错误的objectClass ? private static void ListGroups() { DirectoryEntry objADAM = default(DirectoryEntry); DirectoryEntry objGroupEntry = default(DirectoryEntry); DirectorySearcher objSearchADAM = default(DirectorySearcher); SearchResultCollection objSearchResults = default(SearchResultCollection); SearchResult myResult=null; objADAM = new DirectoryEntry(LDAP); objADAM.RefreshCache(); objSearchADAM = new DirectorySearcher(objADAM); objSearchADAM.Filter = “(&(objectClass=group))”; objSearchADAM.SearchScope = SearchScope.Subtree; objSearchResults = objSearchADAM.FindAll(); // Enumerate groups try { fileGroups.AutoFlush = true; if […]

LDAPS连接出现未知错误(0x80005000)

在烦人的Active Directory位上,我最近几个小时都被困住了。 我想要完成的是通过SSL上的LDAP连接到Active Directory。 身份validation类型是匿名的。 我正在使用.NET Framework 4.0,C#和Visual Studio 2010。 以下代码应根据各种在线资源工作。 但它不断提出令人惊讶的不言自明:“未知错误(0x80005000)”。 DirectoryEntry entry = new DirectoryEntry(); entry.Path = “LDAPS://some.ldap.server:636”; entry.AuthenticationType = AuthenticationTypes.SecureSocketsLayer; DirectorySearcher searcher = new DirectorySearcher(); searcher.searchRoot = entry; searcher.Filter = “(&(objectCategory=person)(objectClass=user))”; SearchResultCollection results = searcher.FindAll(); 我已经将我想要执行的实际查询简化为您在代码中找到的查询。 但即使使用这种通用查询(它应该返回每个AD的工作?),它也会返回错误。

.Net的目录服务引发了一个奇怪的例外

我有一个小的C#解决方案用于检查用户凭据。 它适用于我的两个队友,但在我的电脑上我得到了一个例外。 相关代码: PrincipalContext context = new PrincipalContext(ContextType.Domain); if (context.ValidateCredentials(System.Environment.UserDomainName + “\\” + usr, pwd)) return true; else return false; 例外是: DirectoryOperationException,“服务器无法处理目录请求。”。 我尝试使用显式服务器名称和636端口号创建上下文,但这也没有帮助。 有任何想法吗?

从LDAP查询用户组

如何从C#.NET for ASP中的LDAP活动目录中获取用户组用户。 在我的场景中,我想将用户名传递给从LDAP Active目录查询的方法,并告诉我我的用户是此用户组的成员。 请帮帮我

列出活动目录中的所有计算机

我想知道如何从活动目录中获取所有计算机/机器/ PC的列表? (试图让这个页面成为搜索引擎诱饵,会回复自己。如果有人有更好的回复,我会接受)

iPlanet LDAP和C#PageResultRequestControl

我正在尝试在iPlanet LDAP上进行分页搜索。 这是我的代码: LdapConnection ldap = new LdapConnection(“foo.bar.com:389”); ldap.AuthType = AuthType.Anonymous; ldap.SessionOptions.ProtocolVersion = 3; PageResultRequestControl prc = new PageResultRequestControl(1000); string[] param = new string[] { “givenName” }; SearchRequest req = new SearchRequest(“ou=people,dc=bar,dc=com”, “(ou=MyDivision)”, SearchScope.Subtree, param); req.Controls.Add(prc); while (true) { SearchResponse sr = (SearchResponse)ldap.SendRequest(req); … snip … } 当我运行这个时,我得到一个exception,说明“服务器不支持控制。控制是关键的”在剪辑之前的行上。 快速谷歌搜索没有任何结果。 iPlanet是否支持分页? 如果是这样,我做错了什么? 谢谢。

使用DirectoryServices从C#连接到LDAP

我正在尝试连接到运行LDAP的edirectory 8.8服务器。 我将如何在.Net中进行此操作? 我是否仍然可以使用System.DirectoryService中的类,例如DirectoryEntry和DirectorySearcher,或者它们是否特定于AD? 我是否需要以不同方式指定“连接字符串”? 我正在尝试类似下面的代码,但它似乎不起作用…… DirectoryEntry de = new DirectoryEntry (“LDAP://novellBox.sample.com”,”admin”,”password”,AuthenticationTypes.None); DirectorySearcher ds = new DirectorySearcher(de); var test = ds.FindAll(); 有任何想法吗?