Compartilhar via


<trustLevel> Element

Defines the mapping of specific security levels to named policy files. The <trustLevel> element can be declared at the site level only.

<configuration>
   <system.web>
      <securityPolicy>
         <trustLevel>

   <trustLevel name="Full|High||Medium|Low|Minimal" 
               policyFile="filename.config"/>

Required Attributes

Attribute Option Description
name     Specifies a named security level that is mapped to a policy file. The default is Full.
    Full Specifies that ASP.NET does not restrict security policy with an application domain-specific policy. There is no security policy file associated with Full.
    High Specifies the High security level policy file mapping.
    Medium Specifies the Medium security level policy file mapping.
    Low Specifies the Low security level policy file mapping.
    Minimal Specifies the Minimum security level policy file mapping.
policyFile     Specifies the configuration file that contains security policy settings for the named security level.

Remarks

ASP.NET treats the Full trust specially so it does not have an associated policy file. If Full is set, the ASP.NET host does not add extra application domain-level policy to the application. The Full trust level is always mapped to an internal handler and the policyFile attribute is ignored.

Example

The following example specifies trust level settings for an ASP.NET application.

<system.web>
   <securityPolicy>
      <trustLevel name="Full"    policyFile="internal"/>
      <trustLevel name="High"    policyFile="web_hightrust.config"/>
      <trustLevel name="Medium"  policyFile="web_mediumtrust.config"/>
      <trustLevel name="Low"     policyFile="web_lowtrust.config"/>
      <trustLevel name="Minimal" policyFile="web_minimaltrust.config"/>
   </securityPolicy>
</system.web>

Requirements

Contained Within: <system.web>

Web Platform: IIS 5.0, IIS 5.1, IIS 6.0

Configuration File: Machine.config, Web.config

Configuration Section Handler: System.Web.Security.CodeAccessSecurityHandler

See Also

<securityPolicy> Element | ASP.NET Configuration | ASP.NET Settings Schema