use of Areas in MVC2
asp.net-mvc, asp.net-mvc-2
Solution
I'm trying them out in a CMS using the areas for break downs of the content by type. So I have areas for Calendar, News/Blog, Navigation and Pages (a catch-all fall through).
In my brief experience so far, the benefit of areas are:
- Makes it obvious when calling something from a separate part of the application (ie in a RenderAction).
- Makes it easier to see the connection between Models, Views and Controllers for that part of the application as they are no longer all mixed together.
- Registration of routes for the area are right there -- no longer all mixed together.
I do think that acknowledging the first point is important. For some, the extra work to do RenderAction and similar calls to other areas may be a deal breaker. I've also noticed the routing with areas may be subtly different: I relied on a registered handler in web.config but the routing no longer worked for it after moving my catch-all route to an area. I had to add an explicit ignore for the image handler.
Problem
what is the purpose of "Areas" in MVC2