Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sub-folders for Controllers without Areas

I'm trying to organize the Controllers into sub-folders so that the request would look like:

<domain>/Account/Home
<domain>/Client/Home
<domain>/Vendor/Home

And have the controllers folder like:

Controllers\Account\HomeController
Controllers\Vendor\HomeController
Controllers\Client\HomeController

I am familiar with the Areas in MVC but I prefer not to use that. If there's an alternative way to register routes to use sub-folders on the controllers, please let me know.

like image 411
Ganesh Avatar asked Feb 23 '26 13:02

Ganesh


1 Answers

Why not use Areas? This is one of the reasons why they exist. The alternative would be to add a ton of routes to the RouteCollection (RouteCollection.MapRoute).

http://haacked.com/archive/2008/11/04/areas-in-aspnetmvc.aspx

like image 129
Mark Meisel Avatar answered Feb 25 '26 06:02

Mark Meisel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!