• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2870
  • Last Modified:

ASP.NET MVC Routing to Controller Sub Folders

I'm a classic ASP/PHP developer that's learning ASP.NET. Because of this and because of the fact I have experience with MVC from CodeIgniter I've been looking at ASP.NET MVC.

I'm looking to eventually redo our current classic ASP application in ASP.NET. The application is quite large and I would have a lot of controllers. In CodeIgniter you can create a sub folder inside the controllers directory. So say I had a subfolder in my controller folder called admin which then had a controller called users I could access the add method by going to:

 - mydomain.com/admin/users/add/param

It would be a lot tidier if I could do something like this with ASP.NET MVC. I've searched around on the internet and found a few solutions that people have come up with but I'm not sure I know enough to make an informed decision on the best way.

Is there a method that is generally accepted to be the 'best' way to do it?
1 Solution
Richard LeeSoftware EnthusiastCommented:
A generally accepted best way? I'm not sure if there is, however I have found using attributes on my controller actions to be a useful way. http://stackoverflow.com/questions/894779/asp-net-mvc-routing-via-method-attributes.

As your website if fairly large either you have to create standards when naming routes within your controllers otherwise you can based on the example above build a repository for your routes.


Featured Post

2018 Annual Membership Survey

Here at Experts Exchange, we strive to give members the best experience. Help us improve the site by taking this survey today! (Bonus: Be entered to win a great tech prize for participating!)

Tackle projects and never again get stuck behind a technical roadblock.
Join Now