添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account we would like to generate a file on the fly on the file system Path.GetTempFileName(), then return PhysicalFile(filePath) in the action controller and delete the file right after to avoid filling up the disk.
We created a custom Result to delete the file after it has been executed, look like it's working, but is this approach correct ?

public class PhysicalFileDeleteFileResult : PhysicalFileResult
public override async Task ExecuteResultAsync(ActionContext context)
await base.ExecuteResultAsync(context);
File.Delete(FileName);