The following table describes the time that each security action takes place and the targets that it supports.
In the net_v40_long, runtime support has been removed for enforcing the SecurityAction.Deny, SecurityAction.RequestMinimum, SecurityAction.RequestOptional, and SecurityAction.RequestRefuse permission requests. These requests should not be used in code that is based on net_v40_short or later. For more information about this and other changes, see Security Changes in the .NET Framework Version 4.0.
You should not use SecurityAction.LinkDemand in the net_v40_short. Instead, use the System.Security.SecurityCriticalAttribute to restrict usage to fully trusted applications, or use SecurityAction.Demand to restrict partially trusted callers.
LinkDemand (do not use in the net_v40_short) |
Just-in-time compilation |
Class, method |
InheritanceDemand |
Load time |
Class, method |
Demand |
Run time |
Class, method |
Assert |
Run time |
Class, method |
Deny (obsolete in the net_v40_short) |
Run time |
Class, method |
PermitOnly |
Run time |
Class, method |
RequestMinimum (obsolete in the net_v40_short) |
Grant time |
Assembly |
RequestOptional (obsolete in the net_v40_short) |
Grant time |
Assembly |
RequestRefuse (obsolete in the net_v40_short) |
Grant time |
Assembly |
For additional information about attribute targets, see Attribute.
Member Name | Description |
---|---|
Assert |
The calling code can access the resource identified by the current permission object, even if callers higher in the stack have not been granted permission to access the resource (see [<topic://cpconassert>]). |
Demand |
All callers higher in the call stack are required to have been granted the permission specified by the current permission object (see [<topic://cpconmakingsecuritydemands>]). |
Deny |
The ability to access the resource specified by the current permission object is denied to callers, even if they have been granted permission to access it (see [<topic://cpcondeny>]). |
InheritanceDemand |
The derived class inheriting the class or overriding a method is required to have been granted the specified permission. For more information, see Inheritance Demands. |
LinkDemand |
The immediate caller is required to have been granted the specified permission. Do not use in the net_v40_short. For full trust, use System.Security.SecurityCriticalAttribute instead; for partial trust, use SecurityAction.Demand. |
PermitOnly |
Only the resources specified by this permission object can be accessed, even if the code has been granted permission to access other resources (see [<topic://cpconpermitonly>]). |
RequestMinimum |
The request for the minimum permissions required for code to run. This action can only be used within the scope of the assembly. |
RequestOptional |
The request for additional permissions that are optional (not required to run). This request implicitly refuses all other permissions not specifically requested. This action can only be used within the scope of the assembly. |
RequestRefuse |
The request that permissions that might be misused will not be granted to the calling code. This action can only be used within the scope of the assembly. |