in my controller, this is the code i have
public FileResult Download(string file)
{
var vFullFileName = HostingEnvironment.MapPath("~/App_Data/Files/");
var files = uploadedfileRepository.AllIncluding();
string filename = (from f in files
select f.FileName).First();
return File(Path.Combine(vFullFileName, filename), "application/csv", filename);
}
I put the breakpoint and the file point to the right directory, but why still give me File not found exception?
and in my view this is what i have
<td>
@Html.ActionLink("Download", "Download", new { id = item.FileName})
</td
Your
actionmethod have a parameter with name file. But your are HTML will have a parameter/ query string called id, instead od file, So change your view code toAlso to get the path, try this