Bonjour,

Pour modifier le mot de passe d'un user Active directory, j'ai écris le code suivant:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
 
DirectoryEntry ldap = new DirectoryEntry(txtLDAP.Text, accountName, OldPassword);
ldap.AuthenticationType=AuthenticationTypes.Secure;
DirectorySearcher searcher = new DirectorySearcher(ldap);
searcher.Filter="(samAccountName=" + accountName.Trim() + ")";
SearchResult result = searcher.FindOne();
DirectoryEntry dirUser = result.GetDirectoryEntry();
dirUser.Invoke("ChangePassword", new object[] { txtOldPassword, NewPassword});
dirUser.CommitChanges();
Le problème est que lorsqu'il execute la fonction "Invoke" l'exception suivante est levée:
Une exception non gérée du type 'System.Reflection.TargetInvocationException' s'est produite dans mscorlib.dll

Informations supplémentaires*: Exception has been thrown by the target of an invocation.
Quel est le problème ?

PS: je suis en .net framework 1.1