SecurityManager.SecurityEnabled 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
警告
Because security can no longer be turned off permanently, setting the SecurityEnabled property no longer has any effect. Reading the property will still indicate whether security has been turned off temporarily.
警告
Because security can no longer be turned off, the SecurityEnabled property no longer has any effect.
取得或設定一個值,指示是否啟用安全。
public:
static property bool SecurityEnabled { bool get(); void set(bool value); };
public static bool SecurityEnabled { get; set; }
[System.Obsolete("Because security can no longer be turned off permanently, setting the SecurityEnabled property no longer has any effect. Reading the property will still indicate whether security has been turned off temporarily.")]
public static bool SecurityEnabled { get; set; }
[System.Obsolete("Because security can no longer be turned off, the SecurityEnabled property no longer has any effect.")]
public static bool SecurityEnabled { get; set; }
static member SecurityEnabled : bool with get, set
[<System.Obsolete("Because security can no longer be turned off permanently, setting the SecurityEnabled property no longer has any effect. Reading the property will still indicate whether security has been turned off temporarily.")>]
static member SecurityEnabled : bool with get, set
[<System.Obsolete("Because security can no longer be turned off, the SecurityEnabled property no longer has any effect.")>]
static member SecurityEnabled : bool with get, set
Public Shared Property SecurityEnabled As Boolean
屬性值
true若啟用安全;否則,。 false
- 屬性
例外狀況
呼叫此方法的程式碼不具備 ControlPolicy。
備註
此特性被 Caspol.exe(程式碼存取安全政策工具)所使用。
-security (-s)關閉基於程式碼的安全選項。
SecurityEnabled 提供管理員關閉程式碼存取安全的方式。 當程式碼存取安全被關閉時,所有程式碼存取要求都會成功。 實際上,這會授予所有程式碼 FullTrust。 停用程式碼存取安全可繞過安全系統,因此程式碼的效能可能略優於對 FullTrust 所有程式碼實施的安全政策。 此特性不會使基於角色的安全性失效;因此, PrincipalPermission 訴求不會受到影響。
注意事項
停用程式碼存取安全性會讓系統容易受惡意程式碼的攻擊,如病毒和破壞程式。 關閉程式碼存取安全並不會自動阻止受管理程式碼以任何方式執行。 它只會讓受管理程式碼不受程式碼存取安全系統限制地執行,且必須極度謹慎地執行。 只有在已採取其他安全措施以保護系統安全時,才應關閉安全性以獲得額外效能。 其他安全性措施的範例,包括從公用網路中斷連結、用實際方法保全電腦等等。
此屬性的變更不會在登錄檔中持續存在,直到 SavePolicy 被呼叫為止。 新的程序不會受到變更影響,直到變更被持續存在登錄檔。 在執行中過程中改變此屬性的值,不一定會以預期的方式改變狀態。 為了確保變更生效,您必須打電話 SavePolicy 並啟動新的流程。