This topic has not yet been rated - Rate this topic

PolicyLevel Class

Represents the security policy levels for the common language runtime. This class cannot be inherited.

System.Object
  System.Security.Policy.PolicyLevel

Namespace:  System.Security.Policy
Assembly:  mscorlib (in mscorlib.dll)
[SerializableAttribute]
[ComVisibleAttribute(true)]
public sealed class PolicyLevel

The PolicyLevel type exposes the following members.

  Name Description
Public property FullTrustAssemblies Obsolete. Gets a list of StrongNameMembershipCondition objects used to determine whether an assembly is a member of the group of assemblies used to evaluate security policy.
Public property Label Gets a descriptive label for the policy level.
Public property NamedPermissionSets Gets a list of named permission sets defined for the policy level.
Public property RootCodeGroup Gets or sets the root code group for the policy level.
Public property StoreLocation Gets the path where the policy file is stored.
Public property Type Gets the type of the policy level.
Top
  Name Description
Public method AddFullTrustAssembly(StrongName) Obsolete. Adds a StrongNameMembershipCondition corresponding to the specified StrongName to the list of StrongNameMembershipCondition objects used to determine whether an assembly is a member of the group of assemblies that should not be evaluated.
Public method AddFullTrustAssembly(StrongNameMembershipCondition) Obsolete. Adds the specified StrongNameMembershipCondition to the list of StrongNameMembershipCondition objects used to determine whether an assembly is a member of the group of assemblies that should not be evaluated.
Public method AddNamedPermissionSet Adds a NamedPermissionSet to the current policy level.
Public method ChangeNamedPermissionSet Replaces a NamedPermissionSet in the current policy level with the specified PermissionSet.
Public method Static member CreateAppDomainLevel Obsolete. Creates a new policy level for use at the application domain policy level.
Public method Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method FromXml Reconstructs a security object with a given state from an XML encoding.
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetNamedPermissionSet Returns the NamedPermissionSet in the current policy level with the specified name.
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method Recover Replaces the configuration file for this PolicyLevel with the last backup (reflecting the state of policy prior to the last time it was saved) and returns it to the state of the last save.
Public method RemoveFullTrustAssembly(StrongName) Obsolete. Removes an assembly with the specified StrongName from the list of assemblies the policy level uses to evaluate policy.
Public method RemoveFullTrustAssembly(StrongNameMembershipCondition) Obsolete. Removes an assembly with the specified StrongNameMembershipCondition from the list of assemblies the policy level uses to evaluate policy.
Public method RemoveNamedPermissionSet(NamedPermissionSet) Removes the specified NamedPermissionSet from the current policy level.
Public method RemoveNamedPermissionSet(String) Removes the NamedPermissionSet with the specified name from the current policy level.
Public method Reset Returns the current policy level to the default state.
Public method Resolve Resolves policy based on evidence for the policy level, and returns the resulting PolicyStatement.
Public method ResolveMatchingCodeGroups Resolves policy at the policy level and returns the root of a code group tree that matches the evidence.
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
Public method ToXml Creates an XML encoding of the security object and its current state.
Top
Important note Important

Starting with the .NET Framework version 4, the common language runtime (CLR) is moving away from providing security policy for computers. We recommend that you use Windows Software Restriction Policies (SRP) or AppLocker as a replacement for CLR security policy. The information in this topic applies to the .NET Framework version 3.5 and earlier; it does not apply to the .NET Framework 4 and later. For more information about this and other changes, see Security Changes in the .NET Framework 4.

The highest level of security policy is enterprise-wide. Successive lower levels of hierarchy represent further policy restrictions, but can never grant more permissions than allowed by higher levels. The following policy levels are implemented:

  1. Enterprise: Security policy for all managed code in an enterprise.

  2. Machine: Security policy for all managed code run on the computer.

  3. User: Security policy for all managed code run by the user.

  4. Application domain: Security policy for all managed code in an application.

A policy level consists of a set of code groups organized into a single rooted tree (see CodeGroup), a set of named permission sets that are referenced by the code groups to specify permissions to be granted to code belonging to the code group, and a list of fully-trusted assemblies.

Use SecurityManager.PolicyHierarchy to enumerate the policy levels.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ