コード例 #1
0
        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);
            }
        }
コード例 #2
0
 public Task ExecuteAsync(ActionContext context, PhysicalFileResult result)
 {
     SetHeadersAndLog(context, result);
     return(WriteFileAsync(context, result));
 }