Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4087216
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:49:38+00:00 2026-05-20T18:49:38+00:00

Our institution has a large LDAP system which we access over LDAPS on port

  • 0

Our institution has a large LDAP system which we access over LDAPS on port 636. I’m attempting to create an IQueryable interface to this LDAP which maps onto existing People entities but am having trouble.

I mention the above so folks know my end goal but I’d be satisified today if someone could help me simply run a successful query against this non-AD LDAP, even if its outside of the IQueryable realm. Here’s what I have so far (I’ve edited the password, uid and ou for security):

var url = @"ldaps://ldap.ucdavis.edu:636/uid=s1,ou=s2,dc=ucdavis,dc=edu";
        var password = @"something";

        DirectoryEntry entry = new DirectoryEntry(url);
        entry.Password = password;
        entry.AuthenticationType = AuthenticationTypes.Secure;

        DirectorySearcher mySearcher = new DirectorySearcher(entry);

        SearchResultCollection results;

        results = mySearcher.FindAll();

        foreach(SearchResult resEnt in results) {
            ResultPropertyCollection propcoll = resEnt.Properties;

            foreach (string key in propcoll.PropertyNames)
            {
                foreach (object values in propcoll[key])
                {
                    switch (key)
                    {
                        case "sn":
                            //sb.Append(key.ToString() + "<surname>"
                            //+ values.ToString() + "</surname>");
                            break;
                        case "cn":
                            //sb.Append(key.ToString() + "<cn>"
                            //+ values.ToString() + "</cn>");
                            break;
                        case "name":
                            //sb.Append(key.ToString() + "<name>"
                            //+ values.ToString() + "</name>");
                            break;
                    }
                }
            }
        }

But I keep getting an “unknown error” on the line mySearcher.FindAll(). Anybody see an obvious problem here? Am I specifying the ou and uid correctly?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T18:49:39+00:00Added an answer on May 20, 2026 at 6:49 pm

    >see an obvious problem here?

    Where’s the search query itself?

    DirectorySearcher(entry);
    

    It initializes the searcher given your base path.

    Try setting the “filter” property to a valid LDAP search string, such as “(objectClass=inetOrgPerson)”.

    Also, try setting the SearchScope to OneLevel.

    Anyway, I don’t really think that will help.

    AFAIK DirectorySearcher is merely a wrapper over the ADSI. What you should use instead is the classes from System.DirectoryServices.Protocols namespace, see this article: http://msdn.microsoft.com/en-us/library/bb332056.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say at your job your boss says, That system over there, which has
Our company has until bought a lot VS Pro/Premium and Ultimate Licenses, and each
Our team is creating a new recruitment workflow system to replace an old one.
Our ASP.NET 3.5 website running on IIS 6 has two teams that are adding
We use CRM 4.0 at our institution and have no plans to upgrade presently
Our site has a list of games and we get paid everytime someone signs
I work for a software shop, which has an in house predictive dialer product,
Our last assignment for our compiler theory class has us creating a compiler for
Our company has recent started switching from Blackberries to iPhones and the biggest complaint
Our users input data using html editors (ckeditor and aspxhtmleidtor) which is saved in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.