string actionName = "Users";
[HttpGet]
[ActionName(actionName)]
public ActionResult GetMe()
{
}
…gives: An object reference is required for the non-static field, method, or property
That was just a test though, is there a way to do this? If so, I could re-use the same Controller and possibly create new URIs on the fly… right?
Assuming you have the following controller:
you could write a custom route handler:
Finally associate the custom route handler in your route definitions:
Now if you request
/home/usersit’s theIndexaction of theHomecontroller that will be served.