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)

[SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.ControlPolicy)]
public static PolicyLevel LoadPolicyLevelFromString(
	string str,
	PolicyLevelType type
)

Parameters

str
Type: System.String

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

type
Type: System.Security.PolicyLevelType

One of the PolicyLevelType values.

Return Value

Type: System.Security.Policy.PolicyLevel
The loaded PolicyLevel.

ExceptionCondition
ArgumentNullException

The str parameter is null.

ArgumentException

The str parameter is not valid.

SecurityException

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

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

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

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