Im creating a site for pathology lab in which i have to provide user with the facility to download their reports.

Im creating a zip file(ICSharpCode.SharpZipLib.dll) in which reports are added but i am uanble to delete that zip file after user has downloaded the file..

can u give me idea on which event i have to write the code for deleting the zip file

my code is as follow..

FastZip fx = new FastZip();
fx.CreateZip(path , directory, false, ".pdf$");  
Response.AddHeader("content-Disposition", "Attachment;filename="+ "report.zip");
Response.WriteFile(path + "report.zip");
Response.ContentType = "Application/Zip";
                 
Response.End();
System.IO.File.Delete(path + "report.zip");

on tracing i found that after response.end() the file deleting code is not executed.

write the delete code where the control is returned after response.end()

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.