WindowsAuthenticationEventArgs.User 속성

정의

요청과 연결될 IPrincipal 개체를 가져오거나 설정합니다.

public:
 property System::Security::Principal::IPrincipal ^ User { System::Security::Principal::IPrincipal ^ get(); void set(System::Security::Principal::IPrincipal ^ value); };
public System.Security.Principal.IPrincipal User { get; set; }
member this.User : System.Security.Principal.IPrincipal with get, set
Public Property User As IPrincipal

속성 값

IPrincipal

요청과 연결될 IPrincipal 개체입니다.

예제

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

설명

사용할 수는 User 속성을 설정 합니다 User 속성이 현재 HttpContext 사용자 지정 IPrincipal 개체입니다.

에 대 한 값을 지정 하지 않는 경우는 User 중에 속성을 WindowsAuthentication_OnAuthenticate IIS에서 제공 하는 id가 현재 요청에 대 한 id로 사용 하는 Windows 이벤트. IIS는 익명 인증을 사용 하는 경우 해당 Identity 속성에서 반환 된 id로 설정 되는 GetAnonymous 메서드.

적용 대상

추가 정보