4
Answers

Deleting a file..

meh l

meh l

13y
4.4k
1

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.

Answers (4)
Next Recommended Forum