 悬赏园豆:20
                [已关闭问题] 
            
                    关闭于 2015-03-06 23:12
                悬赏园豆:20
                [已关闭问题] 
            
                    关闭于 2015-03-06 23:12
                 
        DirectoryEntry userEntry = FindObject("user", userName);
 if (userEntry == null)
 {
   parameter = "没找到用户!";
 }
 else
 {
   userEntry.AuthenticationType = AuthenticationTypes.Secure; 
   object[] PassWord = new object[] { password };
   object ret = userEntry.Invoke("SetPassword", "ceocio");
   userEntry.CommitChanges();
 }
报错:
System.Reflection.TargetInvocationException: 调用的目标发生了异常。 ---> System.UnauthorizedAccessException: 拒绝访问。 (异常来自 HRESULT:0x80070005 (E_ACCESSDENIED))
 --- 内部异常堆栈跟踪的结尾 ---
 在 System.DirectoryServices.DirectoryEntry.Invoke(String methodName, Object[] args)
请高手指点~~~
FYI
http://forums.asp.net/t/1619255.aspx?Getting+System+Reflection+TargetInvocationException+while+trying+to+change+the+AD+password+of+an+user+from+web+apps+using+C+
最大可能是你输入的密码不符合Windows的密码策略
楼主的问题解决了吗,能否告诉怎么解决的?谢谢了
object ret = userEntry.Invoke("SetPassword", "ceocio");改成
userEntry.Invoke("ChangePassword", new object[] {"oldpassword", "ceocio"});