Prabu Spark
How to put two actions in the controller with the same name and same parameter type?

Is is possible to put two actions in the controller with the same name and same no. of parameters and parameter type as shown below.

  1. [HttpGet]
  2. public ActionResult Index(int x)
  3. {
  4. return View();
  5. }
  6. [HttpPost]
  7. public ActionResult Index(int a)
  8. {
  9. return View();
  10. }
By Prabu Spark in .NET on Apr 07 2020
  • Guest User
    Aug, 2020 3

    Give there Httpverbs different

    • 0
  • Imogen Harden
    Jul, 2020 21

    Yes because you are using different verbs Get and Post, if you wanted two gets or two posts you could change the route

    • 0
  • Imogen Harden
    Jul, 2020 21

    Yes because you are using different verbs Get and Post, if you wanted two gets or two posts you could change the route

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS