AspNetHostingPermissionLevel AspNetHostingPermissionLevel AspNetHostingPermissionLevel AspNetHostingPermissionLevel Enum

定義

指定授與 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
繼承
AspNetHostingPermissionLevelAspNetHostingPermissionLevelAspNetHostingPermissionLevelAspNetHostingPermissionLevel
屬性

欄位

High High High High 500

表示使用小於或等於 High 信任層級之任何層級的需求保護的功能將會成功。Indicates that features protected with a demand for any level less than or equal to the High trust level will succeed. 此層級適用於高度信任的 Managed 程式碼應用程式,其需要使用大部分支援不完全信任存取的 Managed 權限。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 Low Low 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 Medium Medium 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 Minimal Minimal 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 None None None 100

表示未授與任何權限。Indicates that no permission is granted. AspNetHostingPermission 的所有需求都將失敗。All demands for AspNetHostingPermission will fail.

Unrestricted Unrestricted Unrestricted 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 檔案中的trust configuration 元素, 來設定 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.

適用於

另請參閱