none
Not able to retrieve all users from LDAP server RRS feed

  • Question

  • Hi,

    I am having a requirement of displaying all users in LDAP server. There are 3000+ users available in LDAP. When trying to fetch the data by putting condition like below, the application got hang

    DirectorySearcher searcher = new DirectorySearcher(oDE);

    searcher.Filter = "(&(objectClass=simpleSecurityObject)(uid=*))"; //this retrieve all users 

    However the same code works for dev environment in which LDAP  has 600 users. 

    Please guide me the better way to resolve this issue.

    Thanks

    Monday, April 15, 2019 9:52 AM

All replies

  • Use paging to read your data in pages. Otherwise you're waiting for it to load all the data. Paging will allow you to read/update your UI as you go along. Note that paging is still going to take a while, you'll just be able to let the user know something is going on. 

    Should also mention that your filter doesn't look right for a user. It seems like it is searching everything, not just users. Generally you have to specify the objectClass as `user`.

    Finally note that the server is also going to use SizeLimit so if you're talking about 3000+ users then it isn't going to work. I'm not sure if paging will work around that.


    Michael Taylor http://www.michaeltaylorp3.net

    Monday, April 15, 2019 6:20 PM
    Moderator
  • Hi Michael,

    While creating user , we set the objectClass to "SimpleSecurityObject" so that the same filter has been used for searching the users.

    I tried "PageSize" property to retrieve the results in Pages,but it didn't work. I set PageSize value as "500"

    Tuesday, April 16, 2019 6:52 AM
  • Have you tried removing the uid wildcard search? It doesn't seem like it is doing anything but I'm not an LDAP expert so I don't know. I've never tried to use simpleSecurityObject myself because all our users are set up using the standard Users class. 

    You might want to grab an LDAP testing tool and play around with your queries outside C#. for AD I've used ADExplorer and haven't had any issues but I don't know if it'll work in your environment. If this tool runs slow then the issue may be on the LDAP side. This can be especially true if you have a forest (or whatever LDAP calls it) and querying requires contacting remote servers to get all the data.


    Michael Taylor http://www.michaeltaylorp3.net

    Tuesday, April 16, 2019 1:51 PM
    Moderator