locked
asp.net and ibm Ldap Connection i am daying here !! RRS feed

  • Question

  • User-1483896510 posted

    Dear Frinds

    I am daying here the problem look simple but...

    i am trying to look in ldap by "cn" and password  and i canot find it ( the user is there)

    when i am looking anly cn no problem

    but i need to find this user by user and password

    this is my code

    what is ht eproblem with the filter ??

    (case sensitve was checkd)

    (impersonate is true)

    string LdapPath = ConfigurationSettings.AppSettings["LdapPath"].ToString();

    DirectoryEntry m_Entry = new DirectoryEntry(LdapPath, "", "", AuthenticationTypes.Anonymous);

    m_Entry.Username = ConfigurationSettings.AppSettings["LdapUserName"].ToString();

    m_Entry.Password = ConfigurationSettings.AppSettings["LdapPassword"].ToString();

    using (DirectorySearcher sercher = new DirectorySearcher(m_Entry))

    {

    Object obj = m_Entry.NativeObject; //the bind process

    SearchResultCollection result;

    if (string.IsNullOrEmpty(clientPass))

    sercher.Filter = "cn=" + clientId;

    else

    sercher.Filter = "cn=" + clientId + "userPassword=Leumit1";

     

    //"(&(cn=" + clientId + ")(userPassword=leumit1))";

     

    ///Propertey to load to ldap for serching

    sercher.PropertiesToLoad.Add("cn"); //~Id of the user no exstra digit

    sercher.PropertiesToLoad.Add("sn");//user name -- case sensetive

    sercher.PropertiesToLoad.Add("userPassword");//Password

    sercher.PropertiesToLoad.Add("ou");//last enterence of the user

    sercher.PropertiesToLoad.Add("uid");//last changing password date

    result = sercher.FindAll();

     

    foreach (SearchResult res in result)

    {

    LdapDetails.Add(
    "cn", res.Properties["cn"][0].ToString());

    LdapDetails.Add("sn", res.Properties["sn"][0].ToString());

    LdapDetails.Add("ou", res.Properties["ou"][0].ToString());LdapDetails.Add("uid", res.Properties["uid"][0].ToString());

     

    }

    Sunday, March 8, 2009 4:14 AM

All replies

  • User1747761241 posted

    You might not have annomynous enabled.  I've got those to work before just dropping in my userid my password.  Then had an admin create a profile for me to use once I showed them it worked with my userid.

     

    Sunday, March 8, 2009 10:21 AM
  • User-1483896510 posted

    Can u explain about anonimus acces ??

    i need to validate userpass to ad pass ?

    Sunday, March 8, 2009 11:36 AM
  • User1747761241 posted

    No I really can't explain anomynous access.

     

    Sunday, March 8, 2009 12:16 PM
  • User-1483896510 posted

    dear frinds

    My problem is that i need to verify ldap filde userPassword agains the password the user enter.

    this is ldap ibm.

    i canot filter it canot see it , hw can i verify the userPassword ???

    Wednesday, March 11, 2009 2:21 AM