What are Areas in MVC
Areas allows you to separate your modules and organize Model, View, Controller, Web.config and Routing registration file into separate sections.
Areas allows you to separate your modules and organize Model, View, Controller, Web.config and Routing registration file into separate sections.
Why we use Areas in MVC
In live MVC Project implementation we can use Areas concept for organizing project in better manageable way. Area separate logical section like Model, View, Controller, Web.config, Routing. So for example you have 30 controllers in your projects, rather then working on single controller folder,
we can classify the module wise controllers and separate it in different areas.
So, let us create a MVC Project first, for that follow the steps.
Step 1: Create a new ASP.NET Web Application project and select MVC Template.


Let us create Areas for Teachers Module and Students Module.
Step 2: Right click on Project and add Area and give it name 'Teachers'.

So, inside Areas folder it creates Teachers Module, similarly let us create a Student Module. You can see here each module has separate Model, View, Controller, Web.config and Routing Registration file.

Step 3: Let us add a controller in Students area by right click on Controllers folder, then Add, Controller.
Select MVC 5 Controller - Empty Template, and give name Index.

Step 4: Create a view by right click on index, then Add view, and give name to view, here I gave Index.
Now click on 'Ok'.

Step 5: Inside your Index.cshtml add some text like 'This is Student Dashboard' and build your application.
Now run your application and change url like the following: 'http://localhost/Students/Index'.

Same way you can run TeacherDashboard.

This allows the development team to easily manage their large project by separating Modules. Hope you like this article.

Rajan MishraPosted Sep 5, 2018, 5:40 AM
Well enough and useful.
Sibin ThomasPosted Jun 9, 2017, 5:27 AM
We have to change the startup URL manually or any other technique to do it automatically ?
Ankur MistryPosted Dec 28, 2015, 1:44 AM
Thank you all
Humayun Kabir MamunPosted Dec 28, 2015, 1:44 AM
Nice...
Mayank SharmaPosted Dec 28, 2015, 1:04 AM
Useful Article Sir.
Banketeshvar NarayanPosted Dec 26, 2015, 6:02 AM
Nice Share
Santhakumar MunuswamyPosted Dec 25, 2015, 3:19 PM
Thanks for nice article
Ajay GandhiPosted Dec 25, 2015, 2:01 PM
Explained in a Nice way .....Thanks very useful