I'm working on an ASP.NET MVC3 project, and part of my project is to print PDF files. Everything worked fine until this morning, when I added System.Net.Mail to send attached files. And, also worked fine after this, but when I tried to edit information, I got this error:
The process cannot access the file 'Content\StudentPdf\student54.pdf' because it is being used by another process.
I use iTextSharp to print PDFs, but it crashes at the next line of code:
using (FileStream fs = new FileStream(Server.MapPath("~/Content/StudentPdf/student" + id + ".pdf"), FileMode.Create))
How can I find out where my file is being used in my solution? My PrintPdf method is called before the SendEmail method.