从ActiveDirectory获取用户的问题[ASP.NET中的C#]

时间:2022-03-01 02:58:47

Cannot get the user list from ACtiveDirectory Services when accessed from another system in the same network.

从同一网络中的其他系统访问时,无法从ACtiveDirectory Services获取用户列表。

If accessed from where the code is, then we can obtain the userlist, but cannot get it when accessed from other system in the same network. Any help is utmost appreciated...

如果从代码所在位置访问,那么我们可以获取用户列表,但是当从同一网络中的其他系统访问时无法获取用户列表。任何帮助都非常感激......

Thanks, Venkat.

4 个解决方案

#1


Your problem maybe a "double hop" related issue. The identity of the calling user cannot be passed on further than the server where the code is. One solution is to Bind the call to a user

您的问题可能与“双跃点”相关。调用用户的身份不能传递给代码所在的服务器。一种解决方案是将呼叫绑定到用户

    DirectoryEntry dEntry = new DirectoryEntry("LDAP://path", "uname", "password");
    DirectorySearcher dsSearch = new DirectorySearcher(dEntry);
    dsSearch.Filter = "(objectCategory=user)";

#2


Are you logging in correctly to the DirectoryEntry class?...

您是否正确登录到DirectoryEntry类?...

DirectoryEntry entry = new DirectoryEntry(path, domainAndUsername, password);

#3


Here is an article at csharpcorner about listing user in AD using C#.

以下是csharpcorner上有关使用C#在AD中列出用户的文章。

This one explains How To do (almost) anything with AD using C#.

这个解释了如何(几乎)使用C#做AD的任何事情。

#4


You need to explain the scenario - how is your code deployed (I presume it is deployed as an asp.net webservice). If this is a web service then the most probable cause is the account under which asp.net runs doesnt have enough permissions.

您需要解释这个场景 - 您的代码是如何部署的(我认为它是作为asp.net webservice部署的)。如果这是一个Web服务,那么最可能的原因是asp.net运行的帐户没有足够的权限。

#1


Your problem maybe a "double hop" related issue. The identity of the calling user cannot be passed on further than the server where the code is. One solution is to Bind the call to a user

您的问题可能与“双跃点”相关。调用用户的身份不能传递给代码所在的服务器。一种解决方案是将呼叫绑定到用户

    DirectoryEntry dEntry = new DirectoryEntry("LDAP://path", "uname", "password");
    DirectorySearcher dsSearch = new DirectorySearcher(dEntry);
    dsSearch.Filter = "(objectCategory=user)";

#2


Are you logging in correctly to the DirectoryEntry class?...

您是否正确登录到DirectoryEntry类?...

DirectoryEntry entry = new DirectoryEntry(path, domainAndUsername, password);

#3


Here is an article at csharpcorner about listing user in AD using C#.

以下是csharpcorner上有关使用C#在AD中列出用户的文章。

This one explains How To do (almost) anything with AD using C#.

这个解释了如何(几乎)使用C#做AD的任何事情。

#4


You need to explain the scenario - how is your code deployed (I presume it is deployed as an asp.net webservice). If this is a web service then the most probable cause is the account under which asp.net runs doesnt have enough permissions.

您需要解释这个场景 - 您的代码是如何部署的(我认为它是作为asp.net webservice部署的)。如果这是一个Web服务,那么最可能的原因是asp.net运行的帐户没有足够的权限。