I want to get the current method name of my ASP.NET Core controller
ASP.NET Core
I have tried getting the method name through reflection:
[HttpGet]
You can use the fact that it is not just any method but a controller and use ActionContext.ActionDescriptor.Name property to get the action name
ActionContext.ActionDescriptor.Name
UPDATE: (thanks to Jim Aho)
Recent versions work with -
ControllerContext.ActionDescriptor.ActionName