Export (0) Print
Expand All

EnvironmentPermission Class

Controls access to system and user environment variables. This class cannot be inherited.

Namespace: System.Security.Permissions
Assembly: mscorlib (in mscorlib.dll)

[SerializableAttribute] 
[ComVisibleAttribute(true)] 
public ref class EnvironmentPermission sealed : public CodeAccessPermission, IUnrestrictedPermission
/** @attribute SerializableAttribute() */ 
/** @attribute ComVisibleAttribute(true) */ 
public final class EnvironmentPermission extends CodeAccessPermission implements IUnrestrictedPermission
SerializableAttribute 
ComVisibleAttribute(true) 
public final class EnvironmentPermission extends CodeAccessPermission implements IUnrestrictedPermission

Environment variable names are designated by one or more case-insensitive name lists separated by semicolons, with separate lists for read and write access to the named variables. Write access includes the ability to create and delete environment variables as well as to change existing values.

Caution noteCaution

EnvironmentPermission grants permission for access to the environment variable and its value. To deny access to a variable and its value, you must deny access to it and any other variable which contains the same value. For example, to Deny access to the TMP variable and its value, %USERPROFILE%\Local Settings\Temp, you must Deny access to TMP, TEMP, and any other variable that you can use to access that value. A better technique to deal with multiple paths is to use a combination of PermitOnly and Deny. For more information on this subject and the use of PermitOnly with Deny, see "Canonicalization Problems Using Deny" in Using the Deny Method.

The following code example demonstrates the behavior of the EnvironmentPermission methods. The purpose of this example is to show the results of the methods, not to show how the methods are used.

No code example is currently available or this language may not be supported.

System.Object
   System.Security.CodeAccessPermission
    System.Security.Permissions.EnvironmentPermission

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft