• <bdo id='RaoM7'></bdo><ul id='RaoM7'></ul>

    <i id='RaoM7'><tr id='RaoM7'><dt id='RaoM7'><q id='RaoM7'><span id='RaoM7'><b id='RaoM7'><form id='RaoM7'><ins id='RaoM7'></ins><ul id='RaoM7'></ul><sub id='RaoM7'></sub></form><legend id='RaoM7'></legend><bdo id='RaoM7'><pre id='RaoM7'><center id='RaoM7'></center></pre></bdo></b><th id='RaoM7'></th></span></q></dt></tr></i><div id='RaoM7'><tfoot id='RaoM7'></tfoot><dl id='RaoM7'><fieldset id='RaoM7'></fieldset></dl></div>
    1. <tfoot id='RaoM7'></tfoot>

      1. <small id='RaoM7'></small><noframes id='RaoM7'>

        <legend id='RaoM7'><style id='RaoM7'><dir id='RaoM7'><q id='RaoM7'></q></dir></style></legend>

        c# 通过 LDAP 针对 Active Directory

        c# against Active Directory over LDAP(c# 通过 LDAP 针对 Active Directory)

        1. <i id='FzVnM'><tr id='FzVnM'><dt id='FzVnM'><q id='FzVnM'><span id='FzVnM'><b id='FzVnM'><form id='FzVnM'><ins id='FzVnM'></ins><ul id='FzVnM'></ul><sub id='FzVnM'></sub></form><legend id='FzVnM'></legend><bdo id='FzVnM'><pre id='FzVnM'><center id='FzVnM'></center></pre></bdo></b><th id='FzVnM'></th></span></q></dt></tr></i><div id='FzVnM'><tfoot id='FzVnM'></tfoot><dl id='FzVnM'><fieldset id='FzVnM'></fieldset></dl></div>

          <tfoot id='FzVnM'></tfoot>

            <small id='FzVnM'></small><noframes id='FzVnM'>

              <tbody id='FzVnM'></tbody>
                <bdo id='FzVnM'></bdo><ul id='FzVnM'></ul>
                • <legend id='FzVnM'><style id='FzVnM'><dir id='FzVnM'><q id='FzVnM'></q></dir></style></legend>
                • 本文介绍了c# 通过 LDAP 针对 Active Directory的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在针对 Active Directory 编写一些 c# 代码,并且无休止地尝试使其无法正常工作.以下代码有效,后面的代码无效:

                  I'm coding some c# against Active Directory and have tried endlessly to get this to work to no avail. The following code works and the code that follows it does not:

                  下面的代码使用 "WinNT://" + Environment.MachineName + ",Computer" 进行连接并且工作正常.

                  The code below is using "WinNT://" + Environment.MachineName + ",Computer" to make the connection and works fine.

                     DirectoryEntry localMachine = new DirectoryEntry
                          ("WinNT://" + Environment.MachineName + ",Computer");
                  
                      DirectoryEntry admGroup = localMachine.Children.Find
                          ("Administrators", "group");
                  
                      object members = admGroup.Invoke("members", null);
                  
                      foreach (object groupMember in (IEnumerable)members)
                      {
                          DirectoryEntry member = new DirectoryEntry(groupMember);
                          output.RenderBeginTag("p");
                          output.Write(member.Name.ToString());
                          output.RenderBeginTag("p");
                      }
                  
                  
                  
                      base.Render(output);
                  

                  我现在正在尝试换行:

                  "WinNT://" + Environment.MachineName + ",Computer"
                  

                  "LDAP://MyDomainControllerName"
                  

                  但似乎无论我尝试使用什么值来代替值MyDomainControllerName",它都不起作用.

                  but it seems no matter what value I try in place of the value 'MyDomainControllerName' it wont work.

                  要获得MyDomainControllerName"值,我右键单击 MyComputer 并按照其他地方的建议复制计算机名称值,但这不起作用.

                  To get the 'MyDomainControllerName' value I right clicked on MyComputer and copied the computer name value as suggested elsewhere but this didn't work.

                  当我尝试使用上面的 LDAP://RootDSE 选项时,会导致以下错误:

                  When I try using the LDAP://RootDSE option above it results in the following error:

                  位于路径 LDAP://RootDSE 的 Active Directory 对象不是容器

                  The Active Directory object located at the path LDAP://RootDSE is not a container

                  你提到的成员方法有问题吗?

                  Is this a problem with the member methods as you mention?

                  推荐答案

                  使用 .NET Framework 连接 AD 时,可以使用无服务器"绑定,也可以指定每次使用的服务器(服务器绑定).

                  When connecting to AD using the .NET Framework, you can use "serverless" binding or you can specify a server to use everytime (server bound).

                  以下是同时使用两者的示例:

                  Here's an example of using both:

                  // serverless
                  DirectoryEntry rootConfig = new DirectoryEntry("LDAP://dc=domainname,dc=com");
                  
                  // server bound
                  DirectoryEntry rootEntry = new DirectoryEntry("LDAP://domainControllerName/dc=domainName,dc=com");
                  

                  我认为您误入歧途的是您忘记在最后包含您的域的 FQDN.希望这会有所帮助.

                  I think where you were going astray is you forgot to include the FQDN for your domain on the end. Hope this helps.

                  这篇关于c# 通过 LDAP 针对 Active Directory的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Adding and removing users from Active Directory groups in .NET(在 .NET 中的 Active Directory 组中添加和删除用户)
                  set equality in linq(在 linq 中设置相等)
                  HashSet conversion to List(HashSet 转换为 List)
                  How to set timeout for webBrowser navigate event(如何为 webBrowser 导航事件设置超时)
                  Test whether two IEnumerablelt;Tgt; have the same values with the same frequencies(测试两个IEnumerablelt;Tgt;具有相同频率的相同值)
                  How do you determine if two HashSets are equal (by value, not by reference)?(您如何确定两个 HashSet 是否相等(按值,而不是按引用)?)
                    <bdo id='HDBP4'></bdo><ul id='HDBP4'></ul>

                    <small id='HDBP4'></small><noframes id='HDBP4'>

                        <tbody id='HDBP4'></tbody>

                      • <i id='HDBP4'><tr id='HDBP4'><dt id='HDBP4'><q id='HDBP4'><span id='HDBP4'><b id='HDBP4'><form id='HDBP4'><ins id='HDBP4'></ins><ul id='HDBP4'></ul><sub id='HDBP4'></sub></form><legend id='HDBP4'></legend><bdo id='HDBP4'><pre id='HDBP4'><center id='HDBP4'></center></pre></bdo></b><th id='HDBP4'></th></span></q></dt></tr></i><div id='HDBP4'><tfoot id='HDBP4'></tfoot><dl id='HDBP4'><fieldset id='HDBP4'></fieldset></dl></div>
                        <tfoot id='HDBP4'></tfoot>

                        1. <legend id='HDBP4'><style id='HDBP4'><dir id='HDBP4'><q id='HDBP4'></q></dir></style></legend>