简体   繁体   中英

Access to the path 'C:\\Program Files (x86)\\IIS Express\\Excel.xlsx' is denied

I'm working on a ASP.NET MVC 5 project. In this project I want user to download an Excel file using this code :

var workbook = new ExcelFile();
    workbook.Save("Excel.xlsx");

But when I enter the URL to download the Excel file. I get the exception :

Access to the path 'C:\\Program Files (x86)\\IIS Express\\Excel.xlsx' is denied.

How can I modify my code so that user can download the Excel file wherever he wants? Instead of IIS Express folder. Thanks.

In my opinion you have two options.

1: Chage the permission of the IIS folder/directory.

2: Save the file to Response an let the user choose per SaveFileDialog(try this: Downloading Excel File )

我知道为时已晚,但为了访问该文件夹,您应该以管理员身份运行 Visual Studio。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM