ASP.NET MVC Programmatically Get a List of Controllers

asp.net-mvc, controller

Solution

You can reflect through your assembly and find all classes which inherit from type System.Web.MVC.Controller. Here's some sample code that shows how you could do that:

http://mvcsitemap.codeplex.com/WorkItem/View.aspx?WorkItemId=1567

Problem

In ASP.NET MVC is there a way to enumerate the controllers through code and get their name? example: ``` AccountController HomeController PersonController ``` would give me a list such as: ``` Account, Home, Person ```

Original source

Related problems