语言

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.

从指定的文件加载 a 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

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

返回

加载的策略级别。

特性

例外

参数 path 为 null.

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

调用此方法的代码没有 ControlPolicy。

-或-

调用此方法的代码没有 Read。

-或-

调用此方法的代码没有 Write。

-或-

调用此方法的代码没有 PathDiscovery。

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

适用于