public async Task <IActionResult> DownloadFile(string fileToDownload) { var result = await _fileManagerService.GetInfoForDownload(fileToDownload); if (result == null || string.IsNullOrEmpty(result.FileSystemPath)) { return(NotFound()); } if (result.MimeType == "application/pdf") { return(File(new FileStream(result.FileSystemPath, FileMode.Open), result.MimeType)); //inline } //Response.Headers.Add("Content-Disposition", "attachment; filename=" + result.FileName); //Response.Headers.Add("X-Content-Type-Options", "nosniff"); return(File(new FileStream(result.FileSystemPath, FileMode.Open), result.MimeType, result.FileName)); }