Problem getting Users from ActiveDirectory [C# in ASP.NET]

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

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.

Upvotes: 0

Views: 952

Answers (4)

MSIL
MSIL

Reputation: 2761

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.

Upvotes: 0

TheVillageIdiot
TheVillageIdiot

Reputation: 40507

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

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

Upvotes: 0

Nikos Steiakakis
Nikos Steiakakis

Reputation: 5745

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)";

Upvotes: 2

user110714
user110714

Reputation:

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

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

Upvotes: 1

Related Questions