SecurityManager.LoadPolicyLevelFromFile(String, PolicyLevelType) 方法

定义

注意

现已弃用此 API。

注意

This method is obsolete and will be removed in a future release of the .NET Framework. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.

从指定的文件加载 PolicyLevel

public:
 static System::Security::Policy::PolicyLevel ^ LoadPolicyLevelFromFile(System::String ^ path, System::Security::PolicyLevelType type);
[System.Obsolete]
public static System.Security.Policy.PolicyLevel LoadPolicyLevelFromFile (string path, System.Security.PolicyLevelType type);
public static System.Security.Policy.PolicyLevel LoadPolicyLevelFromFile (string path, System.Security.PolicyLevelType type);
[System.Obsolete("This method is obsolete and will be removed in a future release of the .NET Framework. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")]
public static System.Security.Policy.PolicyLevel LoadPolicyLevelFromFile (string path, System.Security.PolicyLevelType type);
[<System.Obsolete>]
static member LoadPolicyLevelFromFile : string * System.Security.PolicyLevelType -> System.Security.Policy.PolicyLevel
static member LoadPolicyLevelFromFile : string * System.Security.PolicyLevelType -> System.Security.Policy.PolicyLevel
[<System.Obsolete("This method is obsolete and will be removed in a future release of the .NET Framework. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")>]
static member LoadPolicyLevelFromFile : string * System.Security.PolicyLevelType -> System.Security.Policy.PolicyLevel
Public Shared Function LoadPolicyLevelFromFile (path As String, type As PolicyLevelType) As PolicyLevel

参数

path
String

包含安全策略信息的文件的物理文件路径。

type
PolicyLevelType

一个枚举值,其指定要加载的策略级别类型。

返回

PolicyLevel

已加载的策略级别。

属性

例外

path 参数为 null

path 参数指示的文件不存在。

调用此方法的代码不含 ControlPolicy

  • 或 - 调用此方法的代码不含 Read

  • 或 - 调用此方法的代码不含 Write

  • 或 - 调用此方法的代码不含 PathDiscovery

此方法使用代码访问安全性 (CAS) 策略,该策略在 .NET Framework 4 中已过时。 若要使 CAS 策略与早期版本的 .NET Framework 兼容,请使用 <legacyCasPolicy> 元素

适用于