Click here to Skip to main content
15,884,176 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi All,

I've a requirement where in I need to get all the group description of which the user is member of and also of those group's description as well whose member the user is not.
The connection to the external domain has to be trough LDAP with port 389 and with user's credential.

What I have tried:

I am able to validate the user using below code:

<pre>public string UserValidation(string username, string domain, string password, string url)
    {
        var credentials = new NetworkCredential(username, password, domain);
        var serverId = new LdapDirectoryIdentifier(url);

        LdapConnection connection = new LdapConnection(serverId, credentials);

        string result = "true";

            try
            {
                connection.Bind();
            }
            catch (Exception e)
            {
                result = e.ToString();
            }

            connection.Dispose();

            return result;

        }
Posted
Updated 11-Feb-18 22:49pm

1 solution

Have a look at this article. It really helped me when I needed to work with active directory.
 
Share this answer
 
Comments
Pawan Dubey 12-Feb-18 4:56am    
It does not have any thing for retrieving group details externally.
Dylvh 13-Feb-18 3:56am    
Look at the part "A Note On Method Parameters" you'll see the groupDn, then have a look at "Enumerate Objects in an OU" which shows how to loop through the objects (in the example it looks like the users).

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900