public ActionResult Download(int id) { try { var what = this.Data.Files; var fileToDownload = this.Data.Files.GetById(id) as BinaryFile; byte[] fileBytes = FileManipulator.DownloadFile(id, fileToDownload.Type); return(File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, fileToDownload.Name)); } catch (FileNotFoundException) { return(RedirectToAction("Error", "Home")); } }