LoadPolicyLevelFromString Method
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
Not applicable.



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 Server 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 Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0
© 2016 Microsoft