Reputation: 2891
I have a class, and in the same folder I have a .docx file.
The below code is producing a yellow screen of death, claiming access is denied on the document (but in the System32 folder). I have added ASPNET and Network Service as users with modify permissions on the document, in the project's folder (NOT system32).
using (WordprocessingDocument myDoc = WordprocessingDocument.Open("FileName.docx", true)) {}
I'm sure this is something simple and common, but I'm not turning up anything on Google.
Running IIs 7 and .Net 4.
Cheers
Upvotes: 1
Views: 1359
Reputation: 2891
The file had to have the Build Action set to "Content" in order for it to actually copy to the correct place. In addition to that, I also switched from "filename.docx" to Server.MapPath("filename.docx").
Upvotes: 0
Reputation: 41983
It's looking for the file in the current directory, which will be the System32
folder. If you want it to look somewhere else, you can specify the path rather than just FileName.docx
as the filename.
Upvotes: 1