private async Task WriteFileAsync(ActionContext context, PhysicalFileResult result) { var response = context.HttpContext.Response; if (!Path.IsPathRooted(result.FileName)) { throw new NotSupportedException($"{result.FileName}Format File Result Path Not Rooted"); } using (var fileStream = GetFileStream(result.FileName)) { await fileStream.CopyToAsync(response.Body, BufferSize); } }
public Task ExecuteAsync(ActionContext context, PhysicalFileResult result) { SetHeadersAndLog(context, result); return(WriteFileAsync(context, result)); }