I connected on LDAP Server of Apache Directory Studio and binded user with his credentials but now I want to fetch his own data like mail, telephone number etc. How to do that in System.DirectoryServices? Here's what I did up to this point?
LdapDirectoryIdentifier id= new LdapDirectoryIdentifier("localhost", 10389);
LdapConnection conn=
new LdapConnection(id);
var username= text_field_for_username.Text;
var pass= text_field_for_pass.Text;
conn.AuthType = AuthType.Basic;
conn.SessionOptions.ProtocolVersion = 3;
NetworkCredential param= new NetworkCredential("uid="+username+",ou=employees,dc=company,dc=com",pass);
conn.Bind(param);
And it worked. Now, how to fetch data of authenticated user using System.DirectoryServices? By the way, I know about possibility of non-existing user and I will add try and catch block for that purpose.
Basically you can do the following, using DirectoryServices
SearchRequestandSearchResponse:See documentation : SearchRequest, SearchResponse