Click here to Skip to main content
15,921,793 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
public class FileUploadController : Controller
       // GET: /FileUpload/

       public ActionResult File()
           return View();
       public FileResult File()
           return new FilePathResult("~/Files/Document.pdf", "Application.pdf");

Here my intention is to create a downloadable file but when i'am build the project i'am getting the above specified error? even i mentioned with [HttpPost] and Actionname Attributes why?how to solve this? help me thanks in advance

1 solution

You defined two Action Result methods which have the same name "File()".
Rename one of them.
[HttpGet, [ActionName("File")]
public FileResult FileGet()
   return new FilePathResult("~/Files/Document.pdf", "Application.pdf");
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900