codequest
asked on
Delete File after Download
I generate a JPEG from a Graphic, and then download the graphic, using:
Response.Clear()
Response.ContentType = "application/octet-stream"
Response.AddHeader("Conten t-Disposit ion", _
"attachment; filename=""" & varFileName & """")
Response.Flush()
Response.WriteFile(varFile Path & varFileName)
This download works fine. Now I would like to delete the workfile at varFilePath and varFileName, so I do this:
System.IO.File.Delete(varF ilePath & varFileName)
The delete works, except that it causes the "open/save" dialog to not appear, as if it were deleting the file before the
response can get to it. Take out the delete line, response then works again.
What might I do to automatically delete the work file, ensuring that this occurs after the "open/save" dialog of the download as been completed or cancelled?
Thanks!
Response.Clear()
Response.ContentType = "application/octet-stream"
Response.AddHeader("Conten
"attachment; filename=""" & varFileName & """")
Response.Flush()
Response.WriteFile(varFile
This download works fine. Now I would like to delete the workfile at varFilePath and varFileName, so I do this:
System.IO.File.Delete(varF
The delete works, except that it causes the "open/save" dialog to not appear, as if it were deleting the file before the
response can get to it. Take out the delete line, response then works again.
What might I do to automatically delete the work file, ensuring that this occurs after the "open/save" dialog of the download as been completed or cancelled?
Thanks!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for input. I'll try it and postback.
ASKER
Still working my way back to this one....
ASKER
Still working my way back to this one....
ASKER
Thanks for your patience on this. I'm coming back around to needing to write this, so I'll be trying these solutions out soon.
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.
I will leave the following recommendation for this question in the Cleanup topic area:
Accept: rajups {http:#18052303}
Any objections should be posted here in the next 4 days. After that time, the question will be closed.
TheLearnedOne
EE Cleanup Volunteer
I will leave the following recommendation for this question in the Cleanup topic area:
Accept: rajups {http:#18052303}
Any objections should be posted here in the next 4 days. After that time, the question will be closed.
TheLearnedOne
EE Cleanup Volunteer
ASKER