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 屬性所識別。

適用於