How to delete file after download with ASP.NET MVC?

后端 未结 13 1018
执念已碎
执念已碎 2020-12-07 20:51

I want to delete a file immediately after download, how do I do it? I\'ve tried to subclass FilePathResult and override the WriteFile method where

13条回答
  •  伪装坚强ぢ
    2020-12-07 21:36

    SOLUTION:

    One should either subclass the FileResult or create a custom action filter, but the tricky part is to flush the response before trying to delete the file.

提交回复
热议问题