public IActionResult DownloadFile(long productID) { // Will send the productID to service & repository, where it will get the path where the file is // from the database. In the service will get the pdf file and convert to FileStream and send back. Tuple <string, FileStream, bool> stream = service.GetSpecificationFilePdf(productID); if (stream.Item3 == false || stream.Item2 == null) { //return NotFound(); return(new NotFoundResult()); } // Will send the PDF stream to the view, changing the name!!! (security reasons) // In this way no path is send to or from the view! return(new FileStreamResult(stream.Item2, "application/pdf")); }