Area in Asp.net MVC Application

Area is like subsection of the application, which contains completely different set of business functionalities, but compiled under same dll, means not a separate application.

In this tutorial you will learn how to use Area in Asp.net MVC Application, how to add new area in asp.net mvc application!

What is an Area in Asp.Net MVC?

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 functional area, each Area has its own Controllers, Models, Views, completely independent section but united under same assembly.

To add a new area, Right click project => Add => Area

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.

Asp.net Areas Characteristics

  • 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.

how to create area in asp.net mvc

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

 
Area in Asp.net MVC
Aspnet MVC Training
Hire .Net Developer
Free Tutorials
ASP.NET MVC Interview Questions Answers
Asp.net MVC tutorials, learn model view controllers with c#, develop database driven web application using Asp.net MVC framework.
Asp.Net MVC C# Examples | Join Asp.Net MVC Course | Asp.net Core Tutorial