Action Method:
public FileResult DownloadFile()
{
string path = Server.MapPath("~") + "/assets/FileInfo.zip";
byte[] fileBytes = System.IO.File.ReadAllBytes(path);
string fileName = "FileInfo.zip";
return File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
}
View:
<a href="@Url.Action("DownloadFile", "Home")"> Download File</a>
public FileResult DownloadFile()
{
string path = Server.MapPath("~") + "/assets/FileInfo.zip";
byte[] fileBytes = System.IO.File.ReadAllBytes(path);
string fileName = "FileInfo.zip";
return File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
}
View:
<a href="@Url.Action("DownloadFile", "Home")"> Download File</a>
0 Comments
if you have any doubts , please let me know