MVC: Action Name Attribute

Please see my other MVC articles.

Define a Custom Action & URL

When a Controller’s Action method is invoked, the URL reflects the name of the method.
However, it you need the URL to look different without changing the Action method name, assign an ActionName attribute to that method.
First, I’ll begin with a new test Action method.

Notice the URL reflects the name of the method.
However, I want the URL to end with “NewActionName” so I’ll assign an ActionName attribute to that method.
Now when I invoke the method using the attribute name, it’s reflected in the URL.