Response.TransmitFile and delete it after transmission

Posted by Radhi on Stack Overflow See other posts from Stack Overflow or by Radhi
Published on 2010-04-22T04:38:08Z Indexed on 2010/04/22 4:43 UTC
Read the original article Hit count: 558

Hi,

i have to implement GEDCOM export in my site. my .net code created one file at server when export to gedcom clicked. then i need to download it to client from server as well as user should be asked to where to save that file means savedialog is required. after its downloaded. i want to delete that file from server.

i got one code to transmit file from server to client

Response.ContentType = "text/xml";
Response.AppendHeader("Content-Disposition", "attachment; filename=" + FileName);
Response.TransmitFile(Server.MapPath("~/" + FileName));
Response.End();

from this LINK

but i am not able to delete the file after this code as Response.End ends response so whtever code written after that line is not execute. if i do code to delete file before Response.End(); then file does not transmitted and got error.

so, please can anybody provide me any solution for this. -Thanks in advance

© Stack Overflow or respective owner

Related posts about response.transmitfile

Related posts about ASP.NET