WindowsAuthenticationModule.Authenticate イベントとは何? わかりやすく解説 Weblio辞書 (original) (raw)
名前空間: System.Web.Security
アセンブリ: System.Web (system.web.dll 内)
構文
Public Event Authenticate As WindowsAuthenticationEventHandler
Dim instance As WindowsAuthenticationModule Dim handler As WindowsAuthenticationEventHandler
AddHandler instance.Authenticate, handler
public event WindowsAuthenticationEventHandler Authenticate
public: event WindowsAuthenticationEventHandler^ Authenticate { void add (WindowsAuthenticationEventHandler^ value); void remove (WindowsAuthenticationEventHandler^ value); }
/** @event */ public void add_Authenticate (WindowsAuthenticationEventHandler value)
/** @event */ public void remove_Authenticate (WindowsAuthenticationEventHandler value)
JScript では、イベントは使用できますが、新規に宣言することはできません。
Authenticate イベントは、AuthenticateRequest イベント時に生成されます。
WindowsAuthenticationModule クラスの Authenticate イベントには、ASP.NET アプリケーションの Global.asax ファイルに、WindowsAuthentication_OnAuthenticate というサブルーチンを指定することによってアクセスできます。
WindowsAuthentication_OnAuthenticate イベントに渡した WindowsAuthenticationEventArgs オブジェクトの User プロパティを使用して、現在の HttpContext の User プロパティにカスタムの IPrincipal オブジェクトを設定できます。WindowsAuthentication_OnAuthenticate イベント中に User プロパティ値が指定されない場合、IIS によって提供される Windows ID が現在の要求に対する ID として使用されます。IIS が匿名認証を使用する場合、Identity プロパティには、GetAnonymous メソッドによって返される ID が設定されます。
WindowsAuthentication_OnAuthenticate イベントは、認証 Mode が Windows に設定され、WindowsAuthenticationModule がアプリケーションのアクティブ HTTP モジュールである場合にのみ生成されます。
WindowsAuthentication_OnAuthenticate イベントを使用して、現在の HttpContext の User プロパティにカスタム IPrincipal オブジェクトを設定するコード例を次に示します。
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
public void WindowsAuthentication_OnAuthenticate(object sender, WindowsAuthenticationEventArgs args) { if (!args.Identity.IsAnonymous) { args.User = new Samples.AspNet.Security.MyPrincipal(args.Identity); } }
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
.NET Framework
サポート対象 : 2.0、1.1、1.0
関連項目
WindowsAuthenticationModule クラス
WindowsAuthenticationModule メンバ
System.Web.Security 名前空間
その他の技術情報
Windows 認証プロバイダ
Global.asax 構文