locked
Trying to change password on LDAP account (not AD) RRS feed

  • Question

  • User-955851904 posted

    Hi,

    I have prepared the following code for the change password via webpage on a remote LDAP (not AD) on which I have a user:

    string uid = "";
    uid = "uid=" + nomeUtente + "," + pathBase;
    
                        
    DirectoryEntry entry = new DirectoryEntry("LDAP://" + serverAD + "/" + pathBase, uid, model.CurrentPassword, AuthenticationTypes.None);
    
    Object obj = entry.NativeObject;
    
    DirectorySearcher search = new DirectorySearcher(entry);
    search.Filter = "(uid=" + nomeUtente + ")"; //"(&(objectClass=user)(sAMAccountName=" + username + "))";
                        
    SearchResult result = search.FindOne();
    
    entry = result.GetDirectoryEntry();
    entry.Invoke("ChangePassword", new object[] { model.CurrentPassword, model.NewPassword });
    entry.Close();

    Linking with OpenLDAP seems fine until the invoke call. Exception is thrown then:

    The attribute type specified to the directory service is not defined. (Exception from HRESULT: 0x8007200C

    Someone could help me? Thanks

    Monday, September 21, 2015 9:30 AM

All replies

  • User100579902 posted

    It seems this code snippet is ok, could you provide any other information?

    Wednesday, September 23, 2015 3:17 AM