I want to learn is it possible to add additional folder to Controller
folder. My reason is pretty simple: I want to divide my project administration and client sides.
Example: I have a controller named Post
that has actions Index, Details, Delete, Create, Edit
. I want to make one controller as user
controller that will consist of Index, Details
and another controller as admin
controller that will consist of Delte, Create, Edit
. Then I will be able to easy distinguish what is what and put admin validation on whole admin class.
Another reason is that I want my url for administrating my site to look like /admin/post/delete
, not /post/delete
.
So is it possible, and if so then what would be the best way to implement this?
Sound like you want to use MVC Areas? http://www.c-sharpcorner.com/UploadFile/b19d5a/areas-in-Asp-Net-mvc3/
It's just a convention on placing controllers in Controllers folder.
Actually MVC finds controller in current loaded assemblies.
You can place them even in other assemblies.
So, fell free to create additional folders inside Controllers
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With