新文章 网摘 文章 随笔 日记

使用 ASP.NET MVC 下载后如何删除文件?

var fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.None, 4096, FileOptions.DeleteOnClose);
return File(
    fileStream: fs,
    contentType: System.Net.Mime.MediaTypeNames.Application.Octet,
    fileDownloadName: "File.abc");

 

https://stackoverflow.com/questions/2041717/how-to-delete-file-after-download-with-asp-net-mvc

posted @ 2021-10-14 17:06  岭南春  阅读(170)  评论(0)    收藏  举报