> From: calvin.street...@bailygarner.co.uk > To: itext-questions@lists.sourceforge.net > Date: Mon, 23 Aug 2010 14:46:26 +0100 > Subject: [iText-questions] delete temp files after streaming to client? > > Hi. > dose anyone know how/ the order to delete temp files after streaming to > client.. as if i use this it errors the client, prusumabley because it > is still sending it to them.. > > string filein = Server.MapPath("Data") + "\\test.pdftmp"; > string fileout = Server.MapPath("Data") + "\\" + > System.Guid.NewGuid().ToString() + ".pdf"; > //----------------- > do other stuff....... > //----------------- > Response.ContentType = "text/pdf"; > Response.AppendHeader("Content-Disposition", "attachment; filename=" > + filein); > Thread.Sleep(1000); > Response.TransmitFile(fileout); > Thread.Sleep(5000); > System.IO.File.Delete(Server.MapPath("Data") + "\\" + filein + "tmp"); > System.IO.File.Delete(fileout); //<--------nead to fix this > Response.End();
Is there a specific reason for creating the temp file (fileout) streamed to the client? You can use Response.OutputStream instead, it makes things a lot simpler. ------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/