0

.NET で WMI を使用して、Web アプリでリモート マシンに接続しています。接続を初期化するとき、Management ConnectionOptions には常にテキストでユーザー名とパスワードが必要です。たとえば、page.user.identity を介して、現在の Windows ユーザーのコンテキストを使用する方法があるかどうか疑問に思っていました。connectionoptions を空白のままにすると、デフォルトでは何も表示されず、null のままになります。その理由は、ユーザーがログオン/パスワードを入力する必要がないようにするためです。これが、Windows 統合セキュリティの要点ですよね?

どんな情報でも大歓迎です!ありがとう

4

1 に答える 1

2

ConnectionOptions のコンストラクターのこの説明を見てください。ユーザー名とパスワードが null の場合、現在ログオンしているユーザーの資格情報が使用されることが示されています。

ConnectionOptions options = new ConnectionOptions(...);

// Make a connection to a remote computer.
// Replace the "FullComputerName" section of the
// string "\\\\FullComputerName\\root\\cimv2" with
// the full computer name or IP address of the
// remote computer.
ManagementScope scope = 
            new ManagementScope(
            "\\\\FullComputerName\\root\\cimv2", options);
scope.Connect();
于 2010-04-22T14:58:33.773 に答える