用c#修改ad中账户的密码,系统总是提示错误!
HaiHe 2003-09-29 04:32:48 未处理的“System.Reflection.TargetInvocationException”类型的异常出现在 mscorlib.dll 中。
其他信息: 调用的目标发生了异常。
程序如下:
string UserName="";
string strLDAP;
UserName = "user06";
string oldpass = "222$qqq";
string newpass = "333$qqq";
strLDAP="LDAP://CN="+UserName+",ou=outest,DC=system,DC=net";
DirectoryEntry usr = new DirectoryEntry("LDAP://CN=user06,ou=outest,DC=system,DC=net");
//本行提示错误
usr.Invoke("ChangePassword",new object[]{oldpass,newpass});
//下面的程序可以通过
//usr.Invoke("SetPassword", new object[]{newpass});