You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
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);