I am trying to create/overwrite a pdf that was just generated on a folder on my webserver. If I run the code below locally in development it seems to work fine. But if I run it over the web after publishing it I get the message that The process cannot access the file  because it is being used by another process. even though no one has it open. I have tried to Dispose(), Close() and Flush() but no luck. Is there something else I can try? Whats funny is it will work after a few hours. Somehow it releases the lock or something on it after a little time? TIA
 
Dim Doc1 As New Document Dim path As String = "\\server\PDFs\" Dim myUniqueFileName = String.Format("{0}.pdf", random) Dim pdfWrite As PdfWriter = PdfWriter.GetInstance(Doc1, New FileStream(path & myUniqueFileName, FileMode.Create)) Doc1.Open() Dim test As String test = Session(" ...

Go to the complete details ...