About ASP. NETProgramCan be divided into two types:
1) account permissions.
2)Code.
Account permissions can be restricted to all ASP. net Program, and the code permission is ASP.. Net Program, which specifies ASP.. net programs can access resources such as databases and files. They have a common influence on ASP. NET programs. Simply put, ASP. NET programs show the intersection of their common functions.
In IIS 5, the default configuration account of application pool is ASPnet. In IIS 6/7, the ASPNET account is replaced with a network service. Take IIS 7 as an example. If you are using the default network service, then your asp. the resources that the net program can access are limited by network service. In other words, what resources can this account access? Your ASP.. Net program to access resources. By default, network service can read and write all files in the IIS wwwroot folder and access other folders under ACL control.
Scenario 1: During Development under Visual Studio, the account for running Visual Studio is the system account (account for logging on to the machine), which has higher permissions than the network service, therefore, if an error occurs when you deploy the program to IIS, most of them can be considered first.
Scenario 2: When connecting to the database through windows integrated authentication, sometimes the network service account cannot be login. This is also because the system account is used to log on to the database during development, after being deployed to IIS, the network service is used to connect to the database. Therefore, you need to add the network service account to the database.
The Code permission is called code access security (CAS) in ASP. NET. It specifies which resources the ASP. NET program can access. Obviously, in some cases, account permissions cannot easily limit what ASP. NET programs can do. Using cas, we can limit whether ASP. net programs can perform file operations and whether they can access database resources. In the ASP. NET configuration file, it has five different levels. By setting different levels, you can restrict the access resources of the program. If you need details, we suggest you check this article.Article:
Http://msdn.microsoft.com/en-us/library/ms998326.aspx
Scenario 3: After the ASP. Net program is deployed to the paid space, the file cannot be created. This is because the server defines CAS at the machie level and limits all ASP. Net Running on this machine to be unable to perform file operations. The main purpose of this operation is to protect the security of the server.
At the same time, depending on the program needs, we can also use impersonate (usually used for Windows verification ). It can imitate a specific user. In this way, the thread runs on this specific account. In access to domain resources, this is a good way to restrict different users.
Have a nice day!