Modify the file in win7. If the file is not an administrator, this error is returned.
Right-click and run as administrator.
Add a friendly reminder: Try
{
}
Catch (Unauthorizedaccessexception ex)
{
MessageBox. Show ( " Run as administrator. " );
}
The Web processing is said to be like this:
Note: An unhandled exception occurs during the execution of the current Web request. Check the stack trace information to learn about this error andCodeDetailed information about the cause of the error.
Exception details: system. unauthorizedaccessexception: Access denied.
The ASP. NET process is not authorized to access the requested resources. For security reasons, the default ASP. NET process is identified as "{machinename} ASPnet" and has only limited privileges. Consider granting the ASP. Net Process Identity the permission to access this resource.
To grant ASP. NET write access to a file, right-click the file in resource manager, select "properties", and select the "Security" tab. Click Add to add the {machinename} ASPnet user. Highlight this ASP. NET account and select the "write" box in the "allow" column.
1. Enter "dcomcnfg" in "run" to set the running permission of the Excel application COM component.
2. Select the component and attribute to be set.
3. Add ASPnet. To solve the problem after customizing all the settings on the Security tab. It will be a try!
When this method is not feasible:
Copy the user1 user file in the dcoument and setting folder to the current user (to copy the original user environment). All other functions are available, that is, whenProgramIn the word process, an error is reported, indicating that the permission is incorrect. After the permission is configured, an error is still reported. Then, the current user's folder in the dcoument and setting folder is deleted, and everything returns to normal.
URL: http://greatverve.cnblogs.com/archive/2011/12/26/UnauthorizedAccessException.html