1 <Type Name="EnvironmentPermissionAttribute" FullName="System.Security.Permissions.EnvironmentPermissionAttribute" FullNameSP="System_Security_Permissions_EnvironmentPermissionAttribute" Maintainer="ecma">
2 <TypeSignature Language="ILASM" Value=".class public sealed serializable EnvironmentPermissionAttribute extends System.Security.Permissions.CodeAccessSecurityAttribute" />
3 <TypeSignature Language="C#" Value="public sealed class EnvironmentPermissionAttribute : System.Security.Permissions.CodeAccessSecurityAttribute" />
4 <MemberOfLibrary>BCL</MemberOfLibrary>
6 <AssemblyName>mscorlib</AssemblyName>
7 <AssemblyPublicKey>[00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ]</AssemblyPublicKey>
8 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
9 <AssemblyVersion>2.0.0.0</AssemblyVersion>
11 <ThreadingSafetyStatement>All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe.</ThreadingSafetyStatement>
13 <BaseTypeName>System.Security.Permissions.CodeAccessSecurityAttribute</BaseTypeName>
18 <AttributeName>System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.All, AllowMultiple=true, Inherited=false)</AttributeName>
21 <AttributeName>System.Runtime.InteropServices.ComVisible(true)</AttributeName>
26 <para>Used to declaratively specify security actions to control
27 access to environment variables.</para>
30 <para>Environment variable names are case-insensitive. Multiple environment variable names are specified by separating the names
31 using the <see cref="F:System.IO.Path.PathSeparator" />
33 <block subset="none" type="note">
34 <para> The level of access to one or more environment variables is
35 specified using the members of the current instance. For example, to specify
36 read permissions for an environment variable, set the <see cref="P:System.Security.Permissions.EnvironmentPermissionAttribute.Read" /> property equal
37 to the name of the environment variable.</para>
38 <para> The security information declared by a security attribute is stored in the
39 metadata of the attribute target, and is accessed by the system at run-time.
40 Security attributes are used for declarative security only. For imperative
41 security, use the corresponding permission class, <see cref="T:System.Security.Permissions.EnvironmentPermission" />
43 <para>The allowable <see cref="T:System.Security.Permissions.EnvironmentPermissionAttribute" /> targets are determined by the
44 <see cref="T:System.Security.Permissions.SecurityAction" /> passed to the constructor.</para>
48 <para> The following example shows a declarative request for
49 the ability to read the specified environment variables. The <see cref="F:System.Security.Permissions.SecurityAction.RequestMinimum" />
50 security action indicates
51 that this is the minimum permission required for the target assembly to be able
54 <c>[assembly:EnvironmentPermissionAttribute(SecurityAction.RequestMinimum, Read="COMPUTERNAME;USERNAME;USERDOMAIN")]
57 <para>The following example shows how to demand that the
58 calling code has unrestricted access to all environment variables. Demands are
59 typically made in managed libraries to protect methods or classes from
60 malicious code.</para>
62 <c>[EnvironmentPermissionAttribute(SecurityAction.Demand, Unrestricted=true)]
68 <Member MemberName=".ctor">
69 <MemberSignature Language="ILASM" Value="public rtspecialname specialname instance void .ctor(valuetype System.Security.Permissions.SecurityAction action)" />
70 <MemberSignature Language="C#" Value="public EnvironmentPermissionAttribute (System.Security.Permissions.SecurityAction action);" />
71 <MemberType>Constructor</MemberType>
74 <Parameter Name="action" Type="System.Security.Permissions.SecurityAction" />
77 <param name="action">A <see cref="T:System.Security.Permissions.SecurityAction" /> value.</param>
79 <para>Constructs and initializes a new instance of the <see cref="T:System.Security.Permissions.EnvironmentPermissionAttribute" /> class
80 with the specified <see cref="T:System.Security.Permissions.SecurityAction" /> value.</para>
82 <remarks>To be added.</remarks>
83 <exception cref="T:System.ArgumentException">
84 <paramref name="action" /> is not a valid <see cref="T:System.Security.Permissions.SecurityAction" /> value. </exception>
86 <Excluded>0</Excluded>
88 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
89 <AssemblyVersion>2.0.0.0</AssemblyVersion>
92 <Member MemberName="All">
93 <MemberSignature Language="C#" Value="public string All { set; get; }" />
94 <MemberType>Property</MemberType>
96 <ReturnType>System.String</ReturnType>
99 <summary>To be added.</summary>
100 <value>To be added.</value>
101 <remarks>To be added.</remarks>
104 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
105 <AssemblyVersion>2.0.0.0</AssemblyVersion>
108 <Member MemberName="CreatePermission">
109 <MemberSignature Language="ILASM" Value=".method public hidebysig virtual class System.Security.IPermission CreatePermission()" />
110 <MemberSignature Language="C#" Value="public override System.Security.IPermission CreatePermission ();" />
111 <MemberType>Method</MemberType>
113 <ReturnType>System.Security.IPermission</ReturnType>
119 <see cref="T:System.Security.Permissions.EnvironmentPermission" /> that
120 contains the security information of the current instance.</para>
123 <para>A new <see cref="T:System.Security.Permissions.EnvironmentPermission" />
124 object with the security information of the current
128 <block subset="none" type="note">
129 <para>Applications typically do not call this method; it is intended for use by the
131 <para>The security information described by a security attribute is stored in the
132 metadata of the attribute target, and is accessed by the system at run-time. The
133 system uses the object returned by this method to convert the security
134 information of the current instance into the form stored in metadata.</para>
135 <para>This method overrides <see cref="M:System.Security.Permissions.SecurityAttribute.CreatePermission" />.</para>
139 <Excluded>0</Excluded>
141 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
142 <AssemblyVersion>2.0.0.0</AssemblyVersion>
145 <Member MemberName="Read">
146 <MemberSignature Language="ILASM" Value=".property string Read { public hidebysig specialname instance string get_Read() public hidebysig specialname instance void set_Read(string value) }" />
147 <MemberSignature Language="C#" Value="public string Read { set; get; }" />
148 <MemberType>Property</MemberType>
150 <ReturnType>System.String</ReturnType>
155 <para> Gets or sets the environment variables for which read access is
159 <para> A <see cref="T:System.String" />
160 containing one or more environment variables for which read access is secured.</para>
163 <para>Multiple environment variable names are specified by separating the names
164 using the <see cref="F:System.IO.Path.PathSeparator" /> string. Environment variable names are
165 case-insensitive.</para>
167 <block subset="none" type="note">The security action passed to the constructor of the current instance determines how
168 the specified environment variables are secured. For example, if the action is
169 <see cref="F:System.Security.Permissions.SecurityAction.RequestMinimum" /> , then the target
170 of the current instance requires read access to the specified variables in order to
171 execute. If the action is <see cref="F:System.Security.Permissions.SecurityAction.RequestRefuse" />, then the
172 system does not allow the target to read the specified
177 <Excluded>0</Excluded>
179 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
180 <AssemblyVersion>2.0.0.0</AssemblyVersion>
183 <Member MemberName="Write">
184 <MemberSignature Language="ILASM" Value=".property string Write { public hidebysig specialname instance string get_Write() public hidebysig specialname instance void set_Write(string value) }" />
185 <MemberSignature Language="C#" Value="public string Write { set; get; }" />
186 <MemberType>Property</MemberType>
188 <ReturnType>System.String</ReturnType>
194 the environment variables for which write access is secured.</para>
197 <para> A <see cref="T:System.String" /> containing one or more environment variables for which write access is secured.</para>
200 <para>Multiple environment variable names are specified by separating the names
201 using the <see cref="F:System.IO.Path.PathSeparator" /> string. Environment variable names are
202 case-insensitive.</para>
204 <block subset="none" type="note">The security action passed to the
205 constructor of the current instance determines how the specified environment
206 variables are secured. For example, if the action is <see cref="F:System.Security.Permissions.SecurityAction.RequestMinimum" /> , then the target of
207 the current instance requires write access to the specified variables in order
208 to execute. If the action is <see cref="F:System.Security.Permissions.SecurityAction.RequestRefuse" />,
209 then the system does not allow the target to write the specified
214 <Excluded>0</Excluded>
216 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
217 <AssemblyVersion>2.0.0.0</AssemblyVersion>
221 <TypeExcluded>0</TypeExcluded>