Here's the function i made :
using (FileStream ms = new FileStream(Server.MapPath("F16client.pdf"), FileMode.Create, FileAccess.Write, FileShare.None))
PdfReader lecteur = new PdfReader(Server.MapPath("~/Formulaires/f16.pdf"));
PdfStamper etampeur = new PdfStamper(lecteur, ms);
// DO STUFF, Whatever
etampeur.FormFlattening = true;
System.Net.Mail.Attachment at = new Attachment(Server.MapPath("F16client.pdf"));
The process cannot access the file 'D:\inetpub\wwwroot\Formulaire16\F16client.pdf' because it is being used by another process.
Well... no magic here. Thanks to Feryal Badili for pointing out the problem, an email attachement is something that actually holds the ressource...
So, a simple :
before the end of the function and alls good. Yeah...
The reason why it worked on local is probably because i was pushing the
stop everything button everytime i tested, and therefore, i was killing the handle everytime it tried my function.