PermissionSet.Deny 方法

定义

注意

现已弃用此 API。

注意

Deny is obsolete and will be removed in a future release of the .NET Framework. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.

导致通过与当前 PermissionSet 中所含类型的权限具有交集的权限的调用代码的任何 Demand() 失败。

public:
 virtual void Deny();
[System.Obsolete]
public void Deny ();
public virtual void Deny ();
public void Deny ();
[System.Obsolete("Deny is obsolete and will be removed in a future release of the .NET Framework. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")]
public void Deny ();
[<System.Obsolete>]
abstract member Deny : unit -> unit
override this.Deny : unit -> unit
abstract member Deny : unit -> unit
override this.Deny : unit -> unit
[<System.Obsolete("Deny is obsolete and will be removed in a future release of the .NET Framework. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")>]
abstract member Deny : unit -> unit
override this.Deny : unit -> unit
Public Sub Deny ()
Public Overridable Sub Deny ()

实现

属性

例外

Deny() 的前一次调用已经限制当前堆栈帧的权限。

注解

此方法可防止调用堆栈中较高级别的调用方通过调用此方法的代码访问受保护的资源,即使这些调用方已被授予访问它的权限。 调用堆栈通常表示为向下增长,因此调用堆栈中较高方法调用调用堆栈中较低的方法。

Deny 可以限制程序员的责任或帮助防止意外的安全漏洞,因为它有助于防止调用 Deny 的方法用于访问受拒绝权限保护的资源。 如果方法对权限调用 Deny ,并且 Demand 调用堆栈中较低层的调用方调用了该权限的 ,则安全检查在到达 Deny时失败。

Deny 对于未授予的权限,将被忽略,因为对该权限的要求无法成功。

适用于