Here is my code I tried following way to put functionality for download a file but it doesn't work properly. It doesn't show save file dialog.
protected virtual FileResult Download(string FileName, string FilePath)
{
Response.AppendHeader("Content-Length", FileName.Length.ToString());
return File(FilePath, "application/exe", FileName);
}
And tried this way also:
protected virtual ActionResult Download(string FileName, string FilePath)
{
Response.Clear();
Response.AppendHeader("Content-Disposition", "attachment; filename=" + FileName);
Response.AppendHeader("Content-Length", FileName.Length.ToString());
Response.ContentType = "application//x-unknown";
Response.WriteFile(FilePath.Replace("\\", "/"));
Response.Flush();
Response.End();
}
But both are not working. What I missing?