次の方法で共有


WindowsAuthenticationModule クラス

Windows 認証が有効な場合、ASP.NET アプリケーションに対してユーザーの ID を設定します。このクラスは継承できません。

名前空間: System.Web.Security
アセンブリ: System.Web (system.web.dll 内)

構文

'宣言
Public NotInheritable Class WindowsAuthenticationModule
    Implements IHttpModule
'使用
Dim instance As WindowsAuthenticationModule
public sealed class WindowsAuthenticationModule : IHttpModule
public ref class WindowsAuthenticationModule sealed : IHttpModule
public final class WindowsAuthenticationModule implements IHttpModule
public final class WindowsAuthenticationModule implements IHttpModule
適用できません。

解説

認証 ModeWindows に設定されている場合、WindowsAuthenticationModule は、現在の HttpContextUser プロパティを、現在の要求に対して IIS が提供した Windows ID を表す IPrincipal オブジェクトに設定します。IIS が匿名認証を使用する場合、WindowsAuthenticationModule は、GetAnonymous メソッドによって返される ID を使用します。

WindowsAuthenticationModuleAuthenticate イベントを公開します。このイベントにより、現在の HttpContextUser プロパティにカスタム IPrincipal オブジェクトを設定できます。Authenticate イベントには、ASP.NET アプリケーションの Global.asax ファイルに、WindowsAuthentication_OnAuthenticate というサブルーチンを指定することによってアクセスします。

使用例

WindowsAuthentication_OnAuthenticate イベントを使用して、現在の HttpContextUser プロパティにカスタム 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);
  }
}

.NET Framework のセキュリティ

継承階層

System.Object
  System.Web.Security.WindowsAuthenticationModule

スレッド セーフ

この型の public static (Visual Basicでは共有) メンバはすべて,スレッド セーフです。インスタンス メンバの場合は,スレッド セーフであるとは限りません。

プラットフォーム

Windows 98,Windows Server 2000 SP4,Windows CE,Windows Millennium Edition,Windows Mobile for Pocket PC,Windows Mobile for Smartphone,Windows Server 2003,Windows XP Media Center Edition,Windows XP Professional x64 Edition,Windows XP SP2,Windows XP Starter Edition

Microsoft .NET Framework 3.0 は Windows Vista,Microsoft Windows XP SP2,および Windows Server 2003 SP1 でサポートされています。

バージョン情報

.NET Framework

サポート対象 : 3.0,2.0,1.1,1.0

参照

関連項目

WindowsAuthenticationModule メンバ
System.Web.Security 名前空間

その他の技術情報

Windows 認証プロバイダ
Global.asax 構文