Click here to Skip to main content
15,877,966 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am new to MVC.
I have controller and action name. Now I want to debug and check the code but there are so many folders and controller files and I

don't know where is the controller present & don't know how to find it out.

Can someone please help.

What I have tried:

I tried and able to get controller and action name using below code. Now I want to know where the controller is present means in which folder.

RouteData routeData = RouteTable.Routes.GetRouteData(new HttpContextWrapper(HttpContext.Current));
            var action = routeData.GetRequiredString("action");
Updated 11-Aug-17 2:04am

1 solution

Ctrl-F to open the "Find" dialog, then search for "public class <insert start of controller name here>" in the entire solution.
Share this answer
Member 13356890 11-Aug-17 7:19am    
That's a good solution. any other way since sometimes its not working or taking huge time since my application is too big.
F-ES Sitecore 11-Aug-17 7:23am    
There's some add-ons and plug-ins that let you search by type, the most popular (ReSharper) isn't free though however it does way more than type-searching. Someone has probably written an add-on that helps with this stuff, or you could look at using the "Class View" of your solution which lets you navigate things based on namespace and class name rather than folder structure.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900