问题
I have a website where users can upload PDF files and I then parse them using iTextSharp.
The uploaded files are saved to a network share without a problem. I then pass the file path of the newly saved file to iTextSharp:
pdfReader = new PdfReader(fileName);
But I get:
Error: \\networkshare\savedPDF.pdf not found as file or resource. File: \\networkshare\savedPDF.pdf
Looking at the source code I see that it was not able to get the file stream:
inp = BaseFont.GetResourceStream(filePath);
if (inp == null)
throw new IOException(MessageLocalization.GetComposedMessage("1.not.found.as.file.or.resource", filePath));
Since this code works fine on my machine and the file does exist, I can only assume that it is a permissions issue. This issue is only present in production.
How can I determine/set the user that the component runs as?
来源:https://stackoverflow.com/questions/16699386/determine-what-user-account-itextsharp-runs-as