WindowsAuthenticationEventArgs クラス

定義

WindowsAuthentication_OnAuthenticate イベントのデータを提供します。 このクラスは継承できません。

public ref class WindowsAuthenticationEventArgs sealed : EventArgs
public sealed class WindowsAuthenticationEventArgs : EventArgs
type WindowsAuthenticationEventArgs = class
    inherit EventArgs
Public NotInheritable Class WindowsAuthenticationEventArgs
Inherits EventArgs
継承
WindowsAuthenticationEventArgs

次のコード例では 、WindowsAuthentication_OnAuthenticate イベントを使用して、現在HttpContextのプロパティをカスタム IPrincipal オブジェクトに設定Userします。

public void WindowsAuthentication_OnAuthenticate(object sender, WindowsAuthenticationEventArgs args)
{
  if (!args.Identity.IsAnonymous)
  {
    args.User = new Samples.AspNet.Security.MyPrincipal(args.Identity);
  }
}
Public Sub WindowsAuthentication_OnAuthenticate(sender As Object, args As WindowsAuthenticationEventArgs)
  If Not args.Identity.IsAnonymous Then
    args.User = New Samples.AspNet.Security.MyPrincipal(args.Identity)
  End If
End Sub

注釈

このWindowsAuthenticationEventArgsクラスは、WindowsAuthentication_OnAuthenticate イベントにイベント値を指定し、現在の要求のカスタム Windows ID を指定するために使用されます。

IIS WindowsAuthenticationModule によって提供されるWindows ID と現在HttpContextの ID を使用してオブジェクトを構築WindowsAuthenticationEventArgsし、WindowsAuthentication_OnAuthenticate イベントに渡します。

WindowsAuthentication_OnAuthenticate イベントに指定されたオブジェクトのWindowsAuthenticationEventArgsプロパティを使用Userして、現在HttpContextのプロパティをカスタム IPrincipal オブジェクトに設定Userできます。 WindowsAuthentication_OnAuthenticate イベント中にプロパティのUser値を指定しない場合、IIS によって提供されるWindows ID が現在の要求の ID として使用されます。 IIS が匿名認証を使用する Identity 場合、プロパティはメソッドによって返される ID に GetAnonymous 設定されます。

WindowsAuthentication_OnAuthenticate イベントは、認証Modeが設定Windowsされ、アプリケーションのWindowsAuthenticationModuleアクティブな HTTP モジュールである場合にのみ発生します。

コンストラクター

WindowsAuthenticationEventArgs(WindowsIdentity, HttpContext)

WindowsAuthenticationEventArgs クラスの新しく作成されたインスタンスを初期化します。

プロパティ

Context

現在の HTTP 要求に対する HttpContext オブジェクトを取得します。

Identity

WindowsAuthenticationEventArgs コンストラクターに渡される Windows ID を取得します。

User

現在の要求に関連付ける IPrincipal オブジェクトを取得または設定します。

メソッド

Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

適用対象

こちらもご覧ください