Excel: access is denied in ASP. NET

Source: Internet
Author: User

When the Excel component is called in ASP. NET, if the Excel permission in DCOM is not configured, the Program Reports: access is denied.

There are two solutions:

First, set a node in Web. config.

<Identity impersonate = "true"/>

 

However, this method can only solve the problem of Excel access is denied on the local computer.

If it is a server, when a client accesses the page, the same problem still cannot solve the Excel permission problem.

 

Second, configure DCOM

If the program is placed on the server side, but the PC side needs to access the server's program, the first method still cannot be solved. This method can only be used.

1. Run dcomcnfg to open the component service and expand "component services"-> "computers"-> "my computer"-> "DCOM config"

2. Right-click Microsoft Excel application to open the Properties dialog box,

3. Select the "ID" label and then select the Interactive User
4. select the "Security" label. set "launch and activation permissions" to start and activate permissions and "Access Permissions" to custom permissions, and then set system, interactive, everyone, administrators, IUSR _ <machinename>, IWAM _ <machinename> are added to these accounts, and all permissions are granted to them.

4. Click OK and close the component service.

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.