0

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,

user560498
  • 537
  • 1
  • 16
  • 25

1 Answers1

0

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.

Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928
  • I'm sorry, but to clarify, I have a followup question -- I'm actually using MvcSiteMapProvider and have a GetDynamicNodeCollection class which handles dynamic nodes. In that class I have a method which requires the controller name in order to make it more generic. I cannot call that method from the controller... what can I do in this scenario ? -- I'm sorry again if this seems out of context. if it is I'll post a new question. Thanks. – user560498 Jan 02 '11 at 18:05
  • @user560498, you should post a different question explaining your scenario and provide sample code. – Darin Dimitrov Jan 02 '11 at 19:04