System. unauthorizedaccessexception: Exception Handling Method

Source: Internet
Author: User
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

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.