Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Configures the level of code-access security that is applied to an application.
Syntax
class TrustSection : ConfigurationSection  
Methods
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.) | 
Properties
The following table lists the properties exposed by the TrustSection class.
| Name | Description | 
|---|---|
| Level | A required read/write stringvalue 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 Levelproperty can contain a user-defined value if there is a matching security policy mapping defined in aT``rustLevelelement 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 stringvalue that specifies a URL for use with theWebPermissionpermission that is granted inHighandMediumtrust. If present, this can be used for some permissions, such asWebRequest, that allow connectivity only to specific URLs that are specified by aWebPermission. | 
| Path | (Inherited from ConfigurationSection.) A key property. | 
| ProcessRequestInApplicationTrust | A read/write booleanvalue.trueif 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 istrue.Trust policy files are specified in TrustLevelconfiguration elements in theSecurityPolicySectionclass. You can apply a single trust policy to an ASP.NET application by using theLevelproperty. Note:  If theProcessRequestInApplicationTrustproperty is set tofalse, ASP.NET requests can potentially execute underFulltrust, even if theLevelproperty specifies a different trust level. Unless there are specific reasons for doing this, do not reset this property from the default oftrue. This property is new in the .NET Framework 2.0. | 
| SectionInformation | (Inherited from ConfigurationSection.) | 
Subclasses
This class contains no subclasses.
Remarks
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 Unrestrictedin 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. | 
Inheritance Hierarchy
TrustSection
Requirements
| 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 | 
See Also
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