To download a file using a hyperlink, you first need your action link to pass the file name as the route value for the action:
@Html.ActionLink("Download", "Download", new { fileName = Model.AttachmentFileName })
Your action will take fileName , open it for reading in /some/path and return it using the ASP.NET MVC built into FileStreamResult :
public ActionResult Download(string fileName) { try { var fs = System.IO.File.OpenRead(Server.MapPath("/some/path/" + fileName)); return File(fs, "application/zip", fileName); } catch { throw new HttpException(404, "Couldn't find " + fileName); } }
The application/zip parameter is the MIME type of what you are returning. In this case, it is a .zip file.
Here is a list of possible MIME types.
source share