SecurityException.Action 屬性

定義

取得或設定造成例外狀況的安全性動作。Gets or sets the security action that caused the exception.

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 值。One of the SecurityAction values.

屬性

備註

Action屬性包含造成安全性檢查失敗的安全性動作。The Action property contains the security action that caused the security check failure. 許多安全性動作可能會導致擲回安全性例外狀況。Many of the security actions can cause a security exception to be thrown. 例如,許可權集合的要求會檢查呼叫堆疊上的所有呼叫端都具有許可權集合中的必要許可權。For example, a demand on a permission set checks that all callers on the call stack have the necessary permissions in the permission set. 如果呼叫堆疊上的任何呼叫端都缺少必要的許可權,則安全性檢查會失敗。If any caller on the call stack lacks a required permission, the security check fails. 或者,呼叫鏈中的方法可以藉由在堆疊上放置堆疊逐步修飾詞(例如 DenyPermitOnly )來限制允許的許可權,藉以修改堆疊逐步執行的結果。Alternatively, a method in the call chain can modify the outcome of the stack walk by placing a stack walk modifier, such as Deny or PermitOnly, on the stack to limit the allowed permissions. 例如,呼叫堆疊上的方法可能會拒絕其所有呼叫端一組名為 PSET1 的許可權,如此一來,屬於 PSET1 一部分之許可權的任何要求都將會失敗。For example, a method on the call stack might deny all of its callers a set of permissions named PSET1, such that any demand for a permission that is part of PSET1 fails for those callers. Action屬性包含造成擲回例外狀況的安全性動作。The Action property contains the security action that caused the exception to be thrown.

SecurityAction 是命名空間中的列舉 SecurityAction ,可提供屬性的安全性動作值 ActionSecurityAction is an enumeration in the SecurityAction namespace that provides the security action value for the Action property. 這個屬性通常會包含下表所示的其中一個值。Typically this property contains one of the values shown in the following table.

安全性動作Security action 描述Description
Demand 因為對屬性所識別的元件進行了要求,所以完整堆疊的逐步解說失敗 FailedAssemblyInfoA full stack walk failed due to a demand made against the assembly identified by the FailedAssemblyInfo property.
LinkDemand 對屬性所識別之元件的連結要求 FailedAssemblyInfo 失敗。A link demand against the assembly identified by the FailedAssemblyInfo property failed.
InheritanceDemand 由屬性識別的元件 FailedAssemblyInfo 無法符合繼承要求。An assembly identified by the FailedAssemblyInfo property failed to meet an inheritance demand.
PermitOnly 要求的許可權不符合許可權集合中的任何許可權 PermitOnlyA demanded permission did not match any permission in the PermitOnly permission set. PermitOnly 在呼叫堆疊上的方法是由屬性所識別 MethodThe method that placed the PermitOnly on the call stack is identified by the Method property.
Deny 要求的許可權符合呼叫堆疊上拒絕許可權集合中的許可權。A demanded permission matched a permission in the deny permission set on the call stack. Deny 在呼叫堆疊上的方法是由屬性所識別 MethodThe method that placed the Deny on the call stack is identified by the Method property.

適用於