This documentation is archived and is not being maintained.

SecurityManager.LoadPolicyLevelFromString Method

Loads a PolicyLevel from the specified string.

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

public static PolicyLevel LoadPolicyLevelFromString (
	string str,
	PolicyLevelType type
public static PolicyLevel LoadPolicyLevelFromString (
	String str, 
	PolicyLevelType type
public static function LoadPolicyLevelFromString (
	str : String, 
	type : PolicyLevelType
) : PolicyLevel



The XML representation of a security policy level in the same form in which it appears in a configuration file.


One of the PolicyLevelType values.

Return Value

The loaded PolicyLevel.

Exception typeCondition


The str parameter is a null reference (Nothing in Visual Basic).


The str parameter is not valid.


The code that calls this method does not have SecurityPermissionFlag.ControlPolicy.

// Get the 'PolicyLevel' instance for 'Enterprise' policy.
PolicyLevel myPolicyLevel =

// Get the 'PolicyLevel' instance for 'Enterprise' policy.
PolicyLevel myPolicyLevel = System.Security.SecurityManager.
    LoadPolicyLevelFromString(myString, PolicyLevelType.Enterprise);

  • SecurityPermission  for the ability to view and modify policy. Associated enumeration: SecurityPermissionFlag.ControlPolicy

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