I want to download a file or image but error show this.please help me. i am working on asp.net mvc
in controller for download a file
public FileResult DownloadFile(string fileName)
{
var filepath = System.IO.Path.Combine(Server.MapPath("~/Content/FileStorage/"), fileName);
return File(filepath, MimeMapping.GetMimeMapping(filepath), fileName);
}
in view for showing
@Html.ActionLink("Download", "DownloadFile", new { fileName = item.Path })
Error showing
Could not find a part of the path 'E:\Websites\MPOWERING\MPOWERING\MPOWERING\Content\FileStorage\~\Content\FileStorage\scene19313767.jpg'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.IO.DirectoryNotFoundException: Could not find a part of the path 'E:\Websites\MPOWERING\MPOWERING\MPOWERING\Content\FileStorage\~\Content\FileStorage\scene19313767.jpg'.
Salman BegPosted Nov 29, 2019, 9:08 PM
Dhara PatelPosted Nov 29, 2019, 8:56 PM