Sunday, June 24, 2018

How to change the action name in MVC?

“ActionName” attribute can be used for changing the action name. Below is the sample code snippet to demonstrate more –
[ActionName(“TestActionNew”)]
public ActionResult TestAction()
{
return View();
}
So in the above code snippet “TestAction” is the original action name and in “ActionName” attribute, name — “TestActionNew” is given. So the caller of this action method will use the name “TestActionNew” to call this action.