Share via


SecurityException.Action 属性

定义

获取或设置导致异常的安全操作。

public:
 property System::Security::Permissions::SecurityAction Action { System::Security::Permissions::SecurityAction get(); void set(System::Security::Permissions::SecurityAction value); };
[System.Runtime.InteropServices.ComVisible(false)]
public System.Security.Permissions.SecurityAction Action { get; set; }
[<System.Runtime.InteropServices.ComVisible(false)>]
member this.Action : System.Security.Permissions.SecurityAction with get, set
Public Property Action As SecurityAction

属性值

SecurityAction 值之一。

属性

注解

属性Action包含导致安全检查失败的安全操作。 许多安全操作都可能导致引发安全异常。 例如,对权限集的要求检查调用堆栈上的所有调用方是否在权限集中拥有必要的权限。 如果调用堆栈上的任何调用方缺少所需的权限,则安全检查失败。 或者,调用链中的方法可以通过在堆栈上放置堆栈遍进修饰符(如 DenyPermitOnly)来修改堆栈遍转的结果,以限制允许的权限。 例如,调用堆栈上的方法可能会拒绝其所有调用方一组名为 PSET1 的权限,因此,对于这些调用方,对属于 PSET1 的权限的任何要求都会失败。 属性 Action 包含导致引发异常的安全操作。

SecurityAction 是 命名空间中的 SecurityAction 枚举,它为 Action 属性提供安全操作值。 通常,此属性包含下表中显示的值之一。

安全操作 说明
Demand 由于对 属性标识 FailedAssemblyInfo 的程序集提出了要求,完整堆栈遍查失败。
LinkDemand 对属性标识 FailedAssemblyInfo 的程序集的链接请求失败。
InheritanceDemand 属性标识的 FailedAssemblyInfo 程序集无法满足继承需求。
PermitOnly 所需权限与权限集中的任何权限 PermitOnly 都不匹配。 在调用堆栈上放置 PermitOnly 的方法由 Method 属性标识。
Deny 所需权限与调用堆栈上“拒绝”权限集中的权限匹配。 在调用堆栈上放置 Deny 的方法由 Method 属性标识。

适用于