Chris Massey
Nick Harrison


Most sample MVC applications that you see are rather small. This simplicity hides a reality that you will quickly bump up against in any real MVC application of any size. Most applications will need more structure than a single set of Models, Views, and Controllers.

This is where Areas come into play. Each “Area” will have its own set of Models, Views, and Controllers. This allows us to group related functionality adding an extra layer of structure to our web applications. With areas we can separate our application along functional groupings into Areas.

Areas give us some great options for scaling the complexity and scope of an MVC application, but this extra structure comes with its own set of challenges. In this section, we will explore some of these challenges and the best practices for overcoming them.

Areas Overview

Using Areas in an MVC Application [CodeGuru]

Published in 2012. Here Bipin Joshi gives a gentle introduction to the basic mechanics for adding Areas to your application. He gives you a behind the scenes peek at what the IDE does for you to handle registering your Areas. This is good insight to have even though you should never need to explicitly handle such details yourself.

He covers some of the subtle challenges involved in creating links that span Areas. You may not always need this within individual areas, but this will be useful for creating site wide navigation. In fact, if you have an Area that needs a lot of links into another Area, it may be a clue that your Areas are not separated properly. If this happens, you may find that some of your functionality needs to move to the other Area or perhaps the two Areas need to be merged. This is not a hard and fast rule, but something to keep in mind.

Walkthrough: Organizing an MVC Application using Areas [MSDN]

Unknown publishing date, but targets MVC 3. This MSDN Walkthrough gives you a solid understanding not only of the mechanics of creating and using Areas but also the justification why such a feature was added to the framework and why they should be used in your projects.

Resolving Ambiguous Controller Issues

Phil Haack – Ambiguous Controller Names With Areas [Blog]

Published in 2010, targeting MVC 2. This is a very tightly scoped piece, really focusing on just this one issue with no digression. Phil starts with the error message, explains why it’s happening, and dives right into the fix.

Generating links to Actions in Areas

How should I map my routes? [StackOverflow]

Published in 2012. OP is trying to map his routes to a specific HomeController, and asking whether this can be done using a RouteLink instead of ActionLink. There is a single solution offered and, although the solution isn’t particular neat, it seems to work.

How to construct a route to maction action on default controller? [StackOverflow]

Published in 2012. OP encounters some strange failures in routing between areas. It turns out that there are too many defaults on a route, and the solution includes some solid routing advice and a code sample.

Leave a Reply

Your email address will not be published. Required fields are marked *