Modifica

Condividi tramite


SecurityManager.SecurityEnabled Property

Definition

Caution

This API is now deprecated.

Caution

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.

Caution

Because security can no longer be turned off, the SecurityEnabled property no longer has any effect.

Gets or sets a value indicating whether security is enabled.

public:
 static property bool SecurityEnabled { bool get(); void set(bool value); };
[System.Obsolete]
public static bool SecurityEnabled { get; set; }
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; }
[<System.Obsolete>]
static member SecurityEnabled : bool with 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

Property Value

true if security is enabled; otherwise, false.

Attributes

Exceptions

The code that calls this method does not have ControlPolicy.

Remarks

This property is used by the Caspol.exe (Code Access Security Policy Tool)

-security (-s) option to turn off code-based security.

SecurityEnabled provides a way for administrators to disable code access security. When code access security is disabled, all code access demands succeed. Effectively, this grants all code FullTrust. Disabling code access security bypasses the security system so that code might perform slightly better than the equivalent security policy granting FullTrust to all code. This property does not disable role-based security; therefore, PrincipalPermission demands are not affected.

Caution

Disabling code access security makes the system vulnerable to attacks by malicious code such as viruses and worms. Disabling code access security does not automatically block managed code from running in any way. It only causes managed code to run without restriction by the code access security system, and should only be done with the most extreme caution. Turning off security to gain extra performance should only be done when other security measures have been taken to help protect system security. Examples of other security precautions include disconnecting from public networks, physically securing computers, and so on.

A change to this property is not persisted in the registry until SavePolicy is called. New processes will not be affected by the change until it is persisted in the registry. Changing the value of this property in a running process does not necessarily change the state in the expected manner. To ensure changes have taken effect, you must call SavePolicy and start a new process.

Applies to