Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

SecurityManager.LoadPolicyLevelFromFile Method

Loads a PolicyLevel from the specified file.

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

public static PolicyLevel LoadPolicyLevelFromFile (
	string path,
	PolicyLevelType type
)
public static PolicyLevel LoadPolicyLevelFromFile (
	String path, 
	PolicyLevelType type
)
public static function LoadPolicyLevelFromFile (
	path : String, 
	type : PolicyLevelType
) : PolicyLevel

Parameters

path

The physical file path to a file containing the security policy information.

type

One of the PolicyLevelType values.

Return Value

The loaded PolicyLevel.
Exception typeCondition

ArgumentNullException

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

ArgumentException

The file indicated by the path parameter does not exist.

SecurityException

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

-or-

The code that calls this method does not have FileIOPermissionAccess.Read.

-or-

The code that calls this method does not have FileIOPermissionAccess.Write.

-or-

The code that calls this method does not have FileIOPermissionAccess.PathDiscovery.

// Get the 'PolicyLevel' instance for 'Enterprise' policy.
PolicyLevel myPolicyLevel = 
   SecurityManager.LoadPolicyLevelFromFile(args[0],
   PolicyLevelType.Enterprise);

// Get the 'PolicyLevel' instance for 'Enterprise' policy.
PolicyLevel myPolicyLevel = System.Security.SecurityManager.
    LoadPolicyLevelFromFile(args[0], PolicyLevelType.Enterprise);

  • SecurityPermission  for the ability to view and modify policy. Associated enumeration: SecurityPermissionFlag.ControlPolicy
  • FileIOPermission  for reading and writing files. Associated enumerations: FileIOPermissionAccess.Read, FileIOPermissionAccess.Write, FileIOPermissionAccess.PathDiscovery

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
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.