Asp. NET code access security

Source: Internet
Author: User
Tags cas root directory

Code access security, as the name suggests, is used to restrict code. It can limit whether the code can be executed, and in turn, limit what action the ASP.net program can perform. For example, CAS restrictions you do not allow the use of FileIOPermission, then the ASP.net program can not be IO operation. Again, if you limit your use of sqlclientpermission,asp. NET program will not be able to operate SQL Server.

The CAS default defines 5 different level, which are full,high,medium,low and minimal. Permissions are getting lower from full to minimal. Basically, anything can be done at full level, and the minimal level can only perform the most basic mangered code. In our ASP.net program, the trust level is configured in the web.config in the root directory, such as: <trust level= "full"/> If you do not configure it, the default is full level. Today, a host admin role tells you how to protect the server through CAs. There are probably several steps:

1 Identify what action the ASP.net program on the server needs to do.

2 Select one of the most appropriate levels from the predefined 5 levels.

3 If there is no suitable, define a level yourself.

4 The definition level is not allowed to be overwritten.

5) test results.

Step one: Identify what action the ASP.net program on the server needs to do. This is based on host admin to decide, in this respect I do not have much experience, here but more discussion. P.S. If you want to know what permissions your asp.net program needs, you can view it with a tool from the. NET framework. This tool is called Permissions Calculator Tool, and we can call it through the. NET Framework Command window:

Input: percalc-show D:\MyProjects\Job\bin\Job.dll carriage return

Related Article

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.