AspNetHostingPermissionLevel 枚举

定义

指定授予 ASP.NET Web 应用程序的信任级别。Specifies the trust level that is granted to an ASP.NET Web application.

public enum class AspNetHostingPermissionLevel
[System.Serializable]
public enum AspNetHostingPermissionLevel
type AspNetHostingPermissionLevel = 
Public Enum AspNetHostingPermissionLevel
继承
AspNetHostingPermissionLevel
属性

字段

High 500

指示要求受到任何小于或等于 High 信任级别保护的功能将成功。Indicates that features protected with a demand for any level less than or equal to the High trust level will succeed. 此级别适用于高度受信任、托管代码的应用程序,这些应用程序需要使用大多数支持不完全受信任的访问的托管权限。This level is intended for highly trusted managed-code applications that need to use most of the managed permissions that support semi-trusted access. 它不会授予某些最高权限(例如,调用本机代码的能力),但它提供了一种使用最小特权运行受信任的应用程序的方法,或为高度受信任的应用程序提供某种程度上的约束。It does not grant some of the highest permissions (for example, the ability to call into native code), but it does provide a way to run trusted applications with least privilege or to provide some level of constraints for highly trusted applications. 通过在配置文件中的 trust 节中至少配置 High 信任级别,以授予此级别。This level is granted by configuring at least the High trust level in the trust section in a configuration file.

Low 300

指示要求受到任何小于或等于 Low 级别保护的功能将成功。Indicates that features protected with a demand for any level less than or equal to the Low level will succeed. 此级别旨在允许对受约束的环境中有限资源的只读访问。This level is intended to allow read-only access to limited resources in a constrained environment. 通过在配置文件中的 trust 节中指定 Low 信任级别,已授予此级别。This level is granted by specifying the Low trust level in the trust section in a configuration file.

Medium 400

指示要求受到任何小于或等于 Medium 级别保护的功能将成功。Indicates that features protected with a demand for any level less than or equal to the Medium level will succeed. 通过在配置文件中的 trust 节中至少配置 Medium 信任级别,以授予此级别。This level is granted by configuring at least the Medium trust level in the trust section in a configuration file.

Minimal 200

指示要求受到 Minimal 级别保护的功能将成功。Indicates that features protected with a demand for the Minimal level will succeed. 此级别允许代码执行,但不能与系统上存在的资源进行交互。This level allows code to execute but not to interact with resources present on the system. 通过使用配置文件中的 trust 节至少配置 Minimal 信任级别,以授予此级别。This level is granted by configuring at least the Minimal trust level using the trust section in a configuration file.

None 100

指示不授予任何权限。Indicates that no permission is granted. AspNetHostingPermission 的所有要求都将失败。All demands for AspNetHostingPermission will fail.

Unrestricted 600

指示将授予使用应用程序的全部功能所要求的所有权限。Indicates that all demands for permission to use all features of an application will be granted. 这相当于在配置文件的 trust 节中授予 Full 信任级别。This is equivalent to granting Full trust level in the trust section in a configuration file.

注解

有关授予每个信任级别的权限的详细信息, 请参阅ASP.NET 代码访问安全性See ASP.NET Code Access Security for detailed information about the permissions that are granted to each trust level.

此枚举的成员定义从完全信任 (应用程序在代码访问安全性上无限制) 到最小信任 (应用程序只需执行) 的应用程序安全级别。The members of this enumeration define application security levels ranging from full trust (the application is unconstrained by code access security) to minimal trust (the application has permission only to execute). 使用 web.config 或 machine.config 文件中的信任配置元素为 ASP.NET 资源设置信任级别。You set the trust level for an ASP.NET resource with the trust configuration element in a Web.config or Machine.config file.

如果要锁定特定服务器或网站的安全策略, 请结合使用location元素和allowOverride=false属性, 确保不能在本地替代信任策略设置。If you want to lock security policy for a specific server or Web site, use the location element in conjunction with the allowOverride=false attribute to ensure that trust policy settings cannot be overridden locally.

适用于

另请参阅