SecurityManager::SecurityEnabled Property
Gets or sets a value indicating whether security is enabled.
Assembly: mscorlib (in mscorlib.dll)
public: [ObsoleteAttribute("Because security can no longer be turned off, the SecurityEnabled property no longer has any effect.")] property bool SecurityEnabled { static bool get(); static void set(bool value); }
| Exception | Condition |
|---|---|
| SecurityException | The code that calls this method does not have SecurityPermissionFlag::ControlPolicy. |
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.
for the ability to modify policy. Associated enumeration: SecurityPermissionFlag::ControlPolicy
Available since 1.1
