WindowsAuthenticationEventArgs.User 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
현재 요청과 연결할 개체를 가져오거나 설정합니다 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 현재 요청과 연결할 개체입니다.
예제
다음 코드 예제에서는 WindowsAuthentication_OnAuthenticate 이벤트를 사용 하 여 사용자 지정 IPrincipal 개체에 현재 HttpContext 속성을 설정 User 합니다.
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 속성을 사용하여 현재 HttpContext 속성을 사용자 지정 IPrincipal 개체로 설정할 User 수 있습니다.
WindowsAuthentication_OnAuthenticate 이벤트 중에 속성 값을 User 지정하지 않으면 IIS에서 제공하는 Windows ID가 현재 요청의 ID로 사용됩니다. IIS에서 익명 인증을 Identity 사용하는 경우 속성은 메서드에서 반환된 GetAnonymous ID로 설정됩니다.