PrincipalPermission.Demand 메서드

정의

런타임에 현재 보안 주체가 현재 권한으로 지정된 보안 주체와 일치하는지 여부를 결정합니다.

public:
 virtual void Demand();
public void Demand();
abstract member Demand : unit -> unit
override this.Demand : unit -> unit
Public Sub Demand ()

구현

예외

현재 보안 주체는 현재 권한으로 지정된 보안 검사를 통과하지 못합니다.

-또는-

현재 IPrincipal 는 .입니다 null.

설명

발생하지 SecurityExceptionDemand 않으면 성공합니다.

이 메서드는 호출 스레드에 연결된 보안 주체에 대해 작동합니다.

Important

메서드를 Demand 호출하기 전에 현재 애플리케이션 도메인의 주 정책을 열거형 값 WindowsPrincipal으로 설정해야 합니다. 기본적으로 보안 주체 정책은 .로 설정됩니다 UnauthenticatedPrincipal. 주 정책을 WindowsPrincipal설정하지 않으면 보안 주체 권한에 대한 요구가 실패합니다. 보안 주체 권한에 대한 요구가 발생하기 전에 다음 코드를 실행해야 합니다.

AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal).

적용 대상