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

SecurityAction 值之一。

属性

注解

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

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

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

适用于