PermissionSet.PermitOnly Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Causes any Demand() that passes through the calling code for any PermissionSet that is not a subset of the current PermissionSet to fail.
public:
virtual void PermitOnly();
public void PermitOnly ();
public virtual void PermitOnly ();
abstract member PermitOnly : unit -> unit
override this.PermitOnly : unit -> unit
Public Sub PermitOnly ()
Public Overridable Sub PermitOnly ()
Implements
Remarks
PermitOnly is similar to Deny, in that both cause stack walks to fail when they would otherwise succeed. The difference is that Deny specifies permissions that will cause the stack walk to fail, but PermitOnly specifies the only permissions that do not cause the stack walk to fail. Call this method to ensure that your code can be used to access only the specified resources.
PermitOnly is ignored for a permission not granted because a demand for that permission cannot succeed. However, if code lower on the call stack later calls Demand for that permission, a SecurityException is thrown when the stack walk reaches the code that tried to call PermitOnly. This is because the code that called PermitOnly has not been granted the permission, even though it called PermitOnly for that permission. The call stack is typically represented as growing down, so that methods higher in the call stack call methods lower in the call stack.
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기