ASP.NET MVC > Controller

Rename action method in ASP.NET MVC

How to rename action method?

To rename the Action method of the controller, we use ActionName attribute to the action method of the controller.

  public ActionResult Index(string txtKeyword = null)
     return View();

Here, despite that our Action method name is Index, it will be accessible from the browser as PersonList.

Eg.  http://localhost:8888/PersonalDetails/PersonList (assuming that the controller name in which this action method exists is "PersonalDetails".

 Views: 21616 | Post Order: 48

Write for us

Hosting Recommendations