This documentation is archived and is not being maintained.

CodeAccessPermission Class

Defines the underlying structure of all code access permissions.

For a list of all members of this type, see CodeAccessPermission Members.

      Derived classes

[Visual Basic]
MustInherit Public Class CodeAccessPermission
   Implements IPermission, ISecurityEncodable, IStackWalk
public abstract class CodeAccessPermission : IPermission,
   ISecurityEncodable, IStackWalk
public __gc __abstract class CodeAccessPermission : public
   IPermission, ISecurityEncodable, IStackWalk
abstract class CodeAccessPermission implements IPermission,
   ISecurityEncodable, IStackWalk

Thread Safety

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


Code access permissions use a stack walk to ensure that all callers of the code have been granted a permission. If a permission object is a null reference (Nothing in Visual Basic), it is handled the same as a permission object with the state PermissionState.None.

The call stack is typically represented as growing down, so that methods higher in the call stack call methods lower in the call stack.

Inheritors of the CodeAccessPermission class must be granted full trust to function correctly as permissions extending the security infrastructure. To determine that the inheritors are fully trusted, CodeAccessPermission issues an InheritanceDemand for ControlEvidence = True and ControlPolicy = True.

For more information on inheritance demands, see Inheritance Demands.

Notes to Inheritors:  When you inherit from CodeAccessPermission, you must override the following members: Copy, Intersect, IsSubsetOf, ToXml, FromXml, and Union. You must also define a constructor that takes a PermissionState as its only parameter.


Namespace: System.Security

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: Mscorlib (in Mscorlib.dll)

.NET Framework Security: 

See Also

CodeAccessPermission Members | System.Security Namespace | Permissions | Requesting Permissions