This is my View Code and I am using a ViewBag to get the files from controller
<ul class="list-unstyled">
  @foreach (var File in ViewBag.ProjectsFiles)
  {
  <li>
  <span class="text-secondary"> @File.FilesName <span class="btn-link text-secondary"><a  href="http://localhost:44360/Test/Index/DownloadFile?file=@File.FilesName" target="_blank" class="float-right"><i class="fas fa-download"></i></a></span></span>
  </li>
  }
  </ul>
and this is my controller method to download the files on click in link
public void DownloadFile(String file)
        {
            try
            {
                String filename = file;
                String filepath = Server.MapPath("~/Files/" + filename);
                Response.Clear();
                Response.ClearHeaders();
                Response.ClearContent();
                Response.AddHeader("Content-Disposition", "attachment; filename=" + filename);
                Response.Flush();
                Response.TransmitFile(filepath);
                Response.End();
                // HttpContext.ApplicationInstance.CompleteRequest();
                ViewBag.Message = "";
            }
            catch (Exception ex)
            {
                ViewBag.Message = ex.Message.ToString();
            }
        }
But the probleme when I click the file's not downloading. Any hints?
 
     
    