Do Areas in ASP.NET MVC end up being a help or just a drag in the end (because of the URL construction)? Would it be better to have subdirectories inside the main Controllers folder? or are there any other options to organizing a project?


For example, this is your average link without Areas:


and this is your average link with Areas:

@Html.ActionLink("Home","Index", new { Area = "", Controller = "Home"})

Could the following work? (Main controller with subdirectories)

Main controller with subdirectories

I'm just trying to find out if implementing Areas in a project is worthwhile, because I also read that it can be problematic when using Dependency Injection. And is there an alternative to Areas?

  • Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. – gnat Aug 2 '13 at 13:46
  • 1
    @gnat: given the tags, it's pretty clear that the question is about ASP.NET MVC. In this context, the question itself seems pretty clear. – Arseni Mourzenko Aug 2 '13 at 14:47
  • @MainMa my comment referred to first revision of the question, you may take a look at it here. Revised version looks OK to me – gnat Aug 2 '13 at 15:06

In 2013, I think the telling sign is that they were shoved under the carpet by Microsoft and my personal experience has been rather ugly -- if something was big and complex enough to need separate areas I would probably build separate apps and stitch them together using reverse proxies and service calls rather than employing areas directly.

As for your project, it is hard to tell what you are trying to do. If you just want to namespace your controllers a bit and use more than the default routing, that certainly works -- you'll need to tell MVC where to find them when you declare the routes using the string[] namespaces parameter on your route declarations. Linkage would use the standard actionlink options -- with no controller.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.