How could I solve this problem in that code. I've tried some approaches, but I couldn't pass the checkmarx test (system used to perform the scan)
FinalUploadFolder comes from the WebConfig file, which is where the files are saved
public FileResult Index(string attachedFile)
{
string rootPath = System.Configuration.ConfigurationManager.AppSettings.Get("FinalUploadFolder");
byte[] file= System.IO.File.ReadAllBytes(string.Format(Path.Combine(rootPath, attachedFile.ToString())));
return File(file, System.Net.Mime.MediaTypeNames.Application.Octet, attachedFile.ToString());
}