SecurityManager.SecurityEnabled プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > SecurityManager.SecurityEnabled プロパティの意味・解説 

SecurityManager.SecurityEnabled プロパティ

メモ : このプロパティは、互換性のために残されています。

セキュリティが有効かどうかを示す値を取得または設定します。

名前空間: System.Security
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

<ObsoleteAttribute("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 Shared Property SecurityEnabled
 As Boolean
Dim value As Boolean

value = SecurityManager.SecurityEnabled

SecurityManager.SecurityEnabled = value
[ObsoleteAttribute("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; }
[ObsoleteAttribute(L"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 property bool SecurityEnabled {
    bool get ();
    void set (bool value);
}
/** @property */
public static boolean get_SecurityEnabled ()

/** @property */
public static void set_SecurityEnabled
 (boolean value)
public static function get
 SecurityEnabled () : boolean

public static function set
 SecurityEnabled (value : boolean)

プロパティ値
セキュリティが有効な場合は true。それ以外の場合は false。

例外例外
例外の種類条件

SecurityException

このメソッドを呼び出すコードに SecurityPermissionFlag.ControlPolicy がありません。

解説解説

このプロパティを コード アクセス セキュリティ ポリシー ツール (Caspol.exe)-security (-s) オプションで使用して、コード ベース セキュリティをオフにすることができます。

SecurityEnabled を使用すると、管理者はコード アクセス セキュリティを無効にすることができます。コード アクセス セキュリティが無効な場合、すべてのコード アクセス要求は成功します。実質的にこのプロパティは、すべてのコードに FullTrust を与えます。コード アクセス セキュリティを無効にすると、セキュリティ システムがバイパスされます。そのため、すべてのコードに FullTrust を与える同等のセキュリティ ポリシーよりも、コードのパフォーマンスが多少向上することがあります。このプロパティを使用しても、ロール ベースのセキュリティが無効になることはありません。したがって、PrincipalPermission 要求は影響を受けません。

注意に関するメモ注意

コード アクセス セキュリティを無効にすると、システムはウイルスやワームなどの悪意あるコードによる攻撃を受けやすくなります。コード アクセス セキュリティを無効にしても、マネージ コードの実行が自動的にブロックされることは一切ありません。コード アクセス セキュリティ システムによる制限がない状態でマネージ コードが実行できるようになるだけです。これを使用するときは、細心の注意を払ってください。セキュリティをオフにすると確かにパフォーマンスは向上しますが、このセキュリティをオフにするのは、別のセキュリティ対策によってシステムのセキュリティが確保されている場合だけにしてください。その他のセキュリティ対策の例として、パブリック ネットワークからの切断や、物理的なコンピュータの保護などがあります。

このプロパティの変更は、SavePolicy を呼び出すまでレジストリで永続化されません。新しいプロセスは、レジストリで永続化されるまで、変更の影響を受けません。実行中のプロセスでこのプロパティの値を変更しても、必ずしも予想どおりに状態は変更されません。変更を確実に有効にするには、SavePolicy を呼び出して新しいプロセスを開始する必要があります。

使用例使用例

セキュリティが有効になっていることを確認する例を次に示します。

If Not SecurityManager.SecurityEnabled Then
    Throw New SecurityException(myResourceManager.GetString("Security_Required"))
End If
if ( !SecurityManager.SecurityEnabled ) {
    throw new SecurityException(myResourceManager.GetString("Security_Required"));
}
if (  !SecurityManager::SecurityEnabled )
{
   throw gcnew SecurityException( myResourceManager->GetString( "Security_Required"
 ) );
}
if (!(System.Security.SecurityManager.get_SecurityEnabled()))
 {
    throw new System.Security.SecurityException(
        myResourceManager.GetString("Security_Required"));
}
.NET Framework のセキュリティ.NET Framework のセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

SecurityManager.SecurityEnabled プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



SecurityManager.SecurityEnabled プロパティのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS