What is the fault caused by trust level due to program exceptions?

Source: Internet
Author: User

ProgramDuring the development process, debugging runs normally, but an error occurs when the codehighlighter component is configured. The error is as follows:

The first reason is the ACCESS database permission problem. Setting the database permission is invalid. setting the maximum permission for the entire web site is also invalid. The reason must be the codehighlighter component. But on the official website, we found that the trust level of the component runtime environment is "medium" and. <trust level = "medium" originurl = ""/> is set in config. Google has discovered the significance of trust level. The msdn description is as follows:

 
<Trust
Level= "[Full | high | medium | low | minimal]"
Originurl= "Url"
Processrequestinapplicationtrust= "[True | false]"
/>

Level:Required string attribute.

Specify the trust level of the application to be run. Each trust level is mapped to a single XML policy file using the trustlevel element in the configuration file. This policy file lists the permission sets granted by each trust level. For information about ASP. NET and policy files, see ASP. NET trust level and policy file.

If the trustlevel element of the securityPolicy element (ASP. NET setting architecture) defines a matched Security Policy ing, this attribute can be a user-defined value. This attribute can also be one of the following possible values, which are listed in ascending order of the degree of restriction.

full: specifies unlimited permissions. Authorize ASP. NET Applications to access any resources (restricted by operating system security ). Supports all operations granted with privileges. This setting is called unrestricted in the aspnethostingpermissionlevel enumeration. The default value is full (unlimited ).

high: specify the high level Code for access security, this means that the application cannot perform any of the following operations.

  • call unmanaged code.

  • call a service component.

  • write Event Logs.

  • access the Microsoft Message Queue queue.

  • access ODBC, oledb, or Oracle data sources.

medium: specifies medium-level code access security. This means that the ASP. NET application cannot perform any of the following operations except the high limit.

  • access files outside the application directory.

  • access the registry.

low: specifies low-level code access security. This means that the application cannot perform any of the following operations except the medium restriction.

  • write data to the file system.

  • call the assert method to extend the permissions on resources.

minimal: specifies the minimum level of code access security, which means that the application only has the execution permission.

originurl: optional string attribute. Specify a URL for the webpermission permission granted in the high and medium trust levels. If yes, this attribute can be used only to allow certain permissions (such as webrequest) to connect to a specific URL specified by webpermission ). This allows permissions that depend on the concept of the host to work normally.

processrequestinapplicationtrust: optional Boolean attribute.
whether page requests are automatically limited to the permissions configured in the trust policy file applied to ASP. NET applications.
the trust policy file is specified in the trustlevel element of the securityPolicy element. A single trust policy applies to ASP. NET applications by using the Level Attribute of the trust element.
if it is set to false, ASP. NET requests may be executed at the full trust level even if the level Attribute specifies different trust levels. Do not reset this attribute whose default value is true unless it is required for a specific reason.
This attribute is a new attribute in. NET Framework 2.0.
the default value is true. Note: the trust element configuration applies to the application code access security (CAS) level. For each URL, only one trust element should be configured. The security policy file maps to the trust level name in the securityPolicy collection element. This policy file lists the permission sets granted by the trust level. The trust element specifies the trust level applied to ASP. NET applications. For information about ASP. NET and policy files, see ASP. NET trust level and policy file. By default, web applications run at the full trust level. The code access security policy does not limit the code access permissions granted to fully trusted applications. These permissions include built-in system permissions and custom permissions. This means that code access security will not prevent applications from accessing any protected resources. Whether the resource access attempt succeeds or fails is determined by the operating system-level security. If the trust level configured by the application is not full, the application is partially trusted. Some trusted applications have limited permissions, which restrict the application's access to protected resources. To improve the security of the host environment, use the root web. the location element in the config file contains the securityPolicy and trust elements of the Host application, and uses the path attribute to identify the application, and use the AllowOverride = "false" attribute to prevent applications from overwriting a local web. in the config file. To view the example of this configuration type, see the "example" section after this topic.

Because we didn't notice that the access trust level of oledb should be :" Full ", When configuring web. config, set the trust level to" according to codehighlighter" Medium "An error occurred while accessing the database!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.