Trying to add an MVC route to my project to handle a subfolder with controllers. My project structure is as follows:
/Controllers/
- HomeController
- SomeOtherController
/Controllers/Admin
- AdminController
- SomeController
/Views
- Home
- SomeOther
/Views/Admin
- Admin
- Some
The issue is that the controller/views in the admin folders are not being found and giving a n HTTP404 error.
Here is my RouteConfig
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
routes.MapRoute(
name: "Admin",
url: "Admin/{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
I understand that I could use Areas, but I don't want to create a new MVC structure. I simply want to organize my controllers and views into an admin folder.