1

I have created an asp.net MVC 3 project. This project has around 200+ webpages (Views/Partial views). Listing all these links one by one will be very time consuming and tedious. So now I want enlist all link available in this project automatically on single view, so that admin(user) will have access to all links available for respective users.

Here question arises, How to get all url available for views/partial views or to controller action in asp.net MVC?

I was trying asp.net MVC route table. but I think I was trying in wrong direction.

Pranav Labhe
  • 1,943
  • 1
  • 19
  • 24
  • Are these views virtual or real cshtml files? – A G Feb 19 '15 at 06:43
  • 4
    [This answer](http://stackoverflow.com/questions/21583278/getting-all-controllers-and-actions-names-in-c-sharp) shows how to get all the controllers and action methods –  Feb 19 '15 at 06:44
  • these are real .cshtml files. – Pranav Labhe Feb 19 '15 at 06:58
  • Link was not helpfull, it is 0 links in array. – Pranav Labhe Feb 19 '15 at 06:58
  • @PranavLabhe, Its not returning 'links'. Its an example of how you can retrieve all the controller and action names necessary to build you links in a simple `foreach` loop using `@Html.ActionLink("action", "controller")` –  Feb 19 '15 at 07:20
  • i tried this .. '@{ System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly(); var arr = asm.GetTypes() .Where(type => typeof(Controller).IsAssignableFrom(type)) //filter controllers .SelectMany(type => type.GetMethods()) .Where(method => method.IsPublic).ToList(); }' – Pranav Labhe Feb 19 '15 at 07:38
  • but , var arr came with 0 items – Pranav Labhe Feb 19 '15 at 11:34

0 Answers0