Determine what user account iTextSharp runs as

夙愿已清 提交于 2019-12-11 20:14:00

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!