3

スタンドアロン サーバーで実行されている Employee Self Service アプリケーションがあります。アプリケーションの機能の 1 つに「パスワードを忘れた」という機能があり、従業員は自分のパスワードをリセットできます。すべてのサーバーで問題なく動作しますが、Windows Server 2008 R2 では動作しません。以下は、使用するコードの一部です。

User.Invoke("SetPassword", new object[] {"#12345Abc"});
User.CommitChanges();

Windows Server 2008 R2 ではまったく動作しないようです。誰かがそれを機能させている場合は、助けてください。

ありがとう

4

2 に答える 2

1

UserPrincipal.SetPassword を試してください。これはより高いレベルの抽象化であるため、よりスマートです。どの下位レベルの関数を呼び出すかがわかります。呼び出し方法は、私にはあまりにも壊れやすいようです。

于 2010-12-23T18:48:32.493 に答える
1

これも試しました:

PrincipalContext context = new PrincipalContext(ContextType.Machine, "servername");

UserPrincipal up = UserPrincipal.FindByIdentity(context, IdentityType.SamAccountName, "username");
if (up != null)
{
    up.SetPassword("newpassword");
    // We got the same access denied exception here
    up.Save();
}
于 2010-12-23T18:56:59.127 に答える