An area in asp.net MVC is a kind of container / folder / section, in big size asp.net MVC application we can have multiple Subsection or Area, each Area has its own Controllers, Models, Views, completely independent section but united under same assembly.
Why do we need an Area in Asp.Net MVC?
Think of any big size organization which has multiple operational wing, which are very different from each other, Let’s take an example of an FMCG company, which has it Purchase, Sale, Marketing, HR , Account and Operation section, though all are interlinked but they are completely different in terms of their day to day operation.
You may say, in that cases why not build each application separately! Well, if they build separate application then maintenance and deployment cost may be ten times more than maintaining one single umbrella, in such cases we need to come up with this Area concept, which are logically and physically completely separate, clean and easy to maintain and deploy.
Characteristics of Areas in Asp.net MVC
- In a MVC application we can have any number of Areas
- Each Area has its own controllers, models, and views.
- Areas are very useful in managing big size application, easy to maintain
- For each Area, there is a separate folder cerated.
- Multiple business team can work on same project using area
How to create an Area in Asp.Net MVC?
Right click on your web project and add a new Area, as shown below.
Your new Area is ready, now simply create a folder under View called “Home” and a “Home” controller under controller folder.
Then you should be able to access your new area with www.yourwebsite.com/areaName/home
Incase you get an error saying "Multiple types were found that match the controller named 'Home'",here is the solution