WindowsAuthenticationEventArgs.Identity 속성

정의

WindowsAuthenticationEventArgs 생성자에 전달된 Windows ID를 가져옵니다.

public:
 property System::Security::Principal::WindowsIdentity ^ Identity { System::Security::Principal::WindowsIdentity ^ get(); };
public System.Security.Principal.WindowsIdentity Identity { get; }
member this.Identity : System.Security.Principal.WindowsIdentity
Public ReadOnly Property Identity As WindowsIdentity

속성 값

WindowsIdentity

WindowsAuthenticationEventArgs 생성자에 전달된 Windows ID입니다.

예제

다음 코드 예제에서는 합니다 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

설명

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

IIS는 익명 인증을 사용 하는 경우는 Identity 속성에서 반환 된 id로 설정 되는 GetAnonymous 메서드.

적용 대상

추가 정보