WindowsAuthenticationEventHandler 대리자

정의

WindowsAuthenticationModuleWindowsAuthentication_OnAuthenticate 이벤트를 처리하는 메서드를 나타냅니다.

public delegate void WindowsAuthenticationEventHandler(System::Object ^ sender, WindowsAuthenticationEventArgs ^ e);
public delegate void WindowsAuthenticationEventHandler(object sender, WindowsAuthenticationEventArgs e);
type WindowsAuthenticationEventHandler = delegate of obj * WindowsAuthenticationEventArgs -> unit
Public Delegate Sub WindowsAuthenticationEventHandler(sender As Object, e As WindowsAuthenticationEventArgs)

매개 변수

sender
Object

이벤트 소스입니다.

e
WindowsAuthenticationEventArgs

이벤트 데이터를 포함하는 WindowsAuthenticationEventArgs입니다.

예제

다음 코드 예제에서는 합니다 WindowsAuthentication_OnAuthenticate 이벤트가 설정 합니다 User 속성이 현재 HttpContext 사용자 지정 IPrincipal 개체입니다.

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

설명

WindowsAuthenticationEventHandler 대리자에 대해 정의 된 합니다 Authenticate 이벤트는 WindowsAuthenticationModule 클래스. 액세스할 수 있습니다 합니다 Authenticate 의 이벤트를 WindowsAuthenticationModule 라는 서브루틴을 지정 하 여 클래스 WindowsAuthentication_OnAuthenticate ASP.NET 애플리케이션의 Global.asax 파일에. 합니다 Authenticate 이벤트가 발생 하는 동안는 AuthenticateRequest 이벤트입니다.

WindowsAuthenticationModule 생성을 WindowsAuthenticationEventArgs IIS와 현재 제공 하는 Windows id를 사용 하 여 개체 HttpContext 에 전달 합니다 WindowsAuthentication_OnAuthenticate 이벤트.

사용할 수는 User 의 속성을 WindowsAuthenticationEventArgs 개체가 제공를 WindowsAuthentication_OnAuthenticate 이벤트가 설정를 User 속성이 현재 HttpContext 사용자지정IPrincipal개체입니다. 에 대 한 값을 지정 하지 않는 경우는 User 중에 속성을 WindowsAuthentication_OnAuthenticate IIS에서 제공 하는 id가 현재 요청에 대 한 id로 사용 하는 Windows 이벤트. IIS 익명 인증을 사용 하는 경우 해당 Identity 의 속성을 WindowsAuthenticationEventArgs 개체에서 반환 된 id로 설정 됩니다는 GetAnonymous 메서드.

합니다 WindowsAuthentication_OnAuthenticate 이벤트는만 있을 때 발생 인증 Mode 로 설정 되어 WindowsWindowsAuthenticationModule 하는 애플리케이션에 대 한 활성 HTTP 모듈입니다.

확장 메서드

GetMethodInfo(Delegate)

지정된 대리자가 나타내는 메서드를 나타내는 개체를 가져옵니다.

적용 대상

추가 정보