TrustSection Class
Configures the level of code-access security that is applied to an application.
class TrustSection : ConfigurationSection
The following table lists the methods exposed by the TrustSection
class.
Name | Description |
---|---|
GetAllowDefinition | (Inherited from ConfigurationSection.) |
GetAllowLocation | (Inherited from ConfigurationSection .) |
RevertToParent | (Inherited from ConfigurationSection .) |
SetAllowDefinition | (Inherited from ConfigurationSection .) |
SetAllowLocation | (Inherited from ConfigurationSection .) |
The following table lists the properties exposed by the TrustSection
class.
Name | Description |
---|---|
Level |
A required read/write string value that specifies the trust level under which the Web application will run. Each trust level is mapped to an individual XML policy file by using a TrustLevel configuration element. The policy file lists the set of permissions that are granted by each trust level. For more information about ASP.NET and policy files, see ASP.NET Trust Levels and Policy Files.The Level property can contain a user-defined value if there is a matching security policy mapping defined in a T``rustLevel element in the SecurityPolicySection class, or it can contain one of the possible values listed later in the Remarks section. |
Location |
(Inherited from ConfigurationSection .) A key property. |
OriginUrl |
An optional read/write string value that specifies a URL for use with the WebPermission permission that is granted in High and Medium trust. If present, this can be used for some permissions, such as WebRequest , that allow connectivity only to specific URLs that are specified by a WebPermission . |
Path |
(Inherited from ConfigurationSection .) A key property. |
ProcessRequestInApplicationTrust |
A read/write boolean value. true if page requests are automatically restricted to the permissions that are configured in the trust policy file that is applied to the ASP.NET application; otherwise, false . The default is true .Trust policy files are specified in TrustLevel configuration elements in the SecurityPolicySection class. You can apply a single trust policy to an ASP.NET application by using the Level property. Note: If the ProcessRequestInApplicationTrust property is set to false , ASP.NET requests can potentially execute under Full trust, even if the Level property specifies a different trust level. Unless there are specific reasons for doing this, do not reset this property from the default of true . This property is new in the .NET Framework 2.0. |
SectionInformation |
(Inherited from ConfigurationSection .) |
This class contains no subclasses.
The possible values for the Level
property are listed in the following table. The default is Full
(no restrictions).
Value | Description |
---|---|
Full |
Specifies unrestricted permissions. Grants the ASP.NET application permissions to access any resource that is subject to operating system security. All privileged operations are supported. This setting is named Unrestricted in the System.Web.AspNetHostingPermissionLevel enumeration. |
High |
Specifies a high level of code access security, which means that the application cannot do any of the following things: - Call unmanaged code. - Call serviced components. - Write to the event log. - Access Microsoft Windows Message Queuing queues. - Access ODBC, OLE DB, or Oracle data sources. |
Medium |
Specifies a medium level of code access security, which means that, in addition to the restrictions for High , the ASP.NET application cannot do any of the following things:- Access files outside the application directory. - Access the registry. |
Low |
Specifies a low level of code access security, which means that, in addition to the restrictions for Medium , the application cannot do any of the following things:- Write to the file system. - Call the System.Security.CodeAccessPermission.Assert method to expand permissions to resources. |
Minimal |
Specifies a minimal level of code access security, which means that the application has only execute permission. |
TrustSection
Type | Description |
---|---|
Client | - IIS 7.0 on Windows Vista - IIS 7.5 on Windows 7 - IIS 8.0 on Windows 8 - IIS 10.0 on Windows 10 |
Server | - IIS 7.0 on Windows Server 2008 - IIS 7.5 on Windows Server 2008 R2 - IIS 8.0 on Windows Server 2012 - IIS 8.5 on Windows Server 2012 R2 - IIS 10.0 on Windows Server 2016 |
Product | - IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0 |
MOF file | WebAdministration.mof |
System.Web.Configuration.SystemWebSectionGroup.Trust
System.Web.Configuration.TrustSection
System.Web.AspNetHostingPermissionLevel Enumeration
ASP.NET Trust Levels and Policy Files
ConfigurationSection Class
TrustLevel Class
System.Net.WebPermission Class
System.Net.WebRequest Class