Asp.net file path in a solution file
I have a pdf template included in an Asp.net Solution as: "\solution\pdf\template.pdf"
How can I use this file in the project (such as do a filestream)?
I have done
using iTextSharp.text.pdf;
...
string pdfTemplate = HttpContext.Current.Server.MapPath("~\\pdf\\template.pdf");
pdfReader = new PdfReader(pdfTemplate);
It gives me error as "Some program is using this file". I know it is Visual Studio itself. How can I fix this?
Thanks!
Edited:
I thought It would be the path problem. I am using the itextsharp library and I suppose th开发者_如何转开发e Pdfreader would generate a file stream to load the file.Please check ReadStream method, u might not be closing streams. can u post your ReadStream code here
you should change the content of the ReadStream function and open the FileStream with proper FileShare value which would allow you to open the stream even if other processes have the file already open.
精彩评论