WindowsIdentity.GetAnonymous メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
匿名ユーザーを表すために、コード内で sentinel 値として使用できる WindowsIdentity オブジェクトを返します。 プロパティ値は、Windows オペレーティング システムが使用する組み込み匿名 ID を表しません。
public:
static System::Security::Principal::WindowsIdentity ^ GetAnonymous();
public static System.Security.Principal.WindowsIdentity GetAnonymous ();
static member GetAnonymous : unit -> System.Security.Principal.WindowsIdentity
Public Shared Function GetAnonymous () As WindowsIdentity
戻り値
匿名のユーザーを表すオブジェクト。
例
次のコードは、 メソッドを使用して、ユーザーが匿名のオブジェクトを表す GetAnonymous WindowsIdentity オブジェクトWindows示しています。 このコード例は、WindowsIdentity クラスのために提供されている大規模な例の一部です。
WindowsIdentity^ windowsIdentity = WindowsIdentity::GetAnonymous();
WindowsIdentity windowsIdentity = WindowsIdentity.GetAnonymous();
Dim windowsIdentity As WindowsIdentity
windowsIdentity = windowsIdentity.GetAnonymous()
注釈
このプロパティは、操作を WindowsIdentity 匿名として扱える空の オブジェクトを返します。 プロパティ値は、匿名ユーザーのWindowsに対応していないので、権限借用には使用できません。 また、このプロパティによって返される ID は静的ではありません。の呼び出し GetAnonymous ごとに、異なる匿名 ID が返されます。
プロパティを使用 IsAnonymous して、 から戻り値を検出できます GetAnonymous 。 ただし、 IsAnonymous は、このメソッドWindows匿名 ID と匿名 ID の両方を検出します。 後者の ID を使用するには、 プロパティ GetAnonymous に依存するのではなく、戻り値をキャッシュ IsAnonymous します。