Get Current Controller name from outside a view and controller

842 Views Asked by At

I have tried using the ControllerContext object, but I don't know how to instantiate it. I'd like to remind you that I'm trying to get the controller name in a custom class outside a view or a controller. Thanks,

1

There are 1 best solutions below

2
Darin Dimitrov On BEST ANSWER

Don't do this. Simply pass the controller name as parameter from within the controller to whatever class needs it. Current controller is a notion that doesn't make sense from outside of a controller.