Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用SetPassword以编程方式更改Active Directory密码,创建多个密码_C#_Asp.net_Exchange Server - Fatal编程技术网

C# 使用SetPassword以编程方式更改Active Directory密码,创建多个密码

C# 使用SetPassword以编程方式更改Active Directory密码,创建多个密码,c#,asp.net,exchange-server,C#,Asp.net,Exchange Server,我正在使用UserPrincipal类的SetPassword方法更改exchange密码。但问题是,它似乎要创建另一个密码并保留旧密码。我当前的密码是“123”,如果我这样做: PrincipalContext Adcontext = new PrincipalContext(ContextType.Domain, "domain", "superuser", "password"); UserPrincipal userdomain = UserPrincipal.FindByIdentit

我正在使用UserPrincipal类的SetPassword方法更改exchange密码。但问题是,它似乎要创建另一个密码并保留旧密码。我当前的密码是“123”,如果我这样做:

PrincipalContext Adcontext = new PrincipalContext(ContextType.Domain, "domain", "superuser", "password");
UserPrincipal userdomain = UserPrincipal.FindByIdentity(Adcontext, "UserIWantToChange");

userdomain.SetPassword("newpassordcompletlynewinsaneinthebrain");

并且我尝试登录outlook,2密码将起作用!如果我使用“ValidateCredentials”,那么2也会起作用。这正常吗?我怎样才能防止这种情况

好吧,我找到了原因。我回答我的新问题是为了帮助更多有同样问题的人。这是由于缓存的域凭据造成的。你可以禁用它。这里有一个有用的链接,解释了如何做