Creating and working with areas
In this recipe, you will learn how to manage areas in ASP.NET Core. To do this, we will:
- Create areas
- Create area routes
- Avoid area route conflict
- Change the default views location
- Create links for an area's action controllers
Getting ready
We created an empty web application with VS 2017.
How to do it...
When structuring an MVC application, sometimes, we need functional separation. The application we develop could be larger than it seems, such that we have several applications in an application. Areas give us the capability to create a lot of MVC structures in function of our needs, and give us a way to manage complex applications more easily. For example, in an e-commerce application, we could need different areas for the administration part of the website, which correspond to different roles (user managing, marketing, motor search reference, orders tracking, stock management), plus the website itself, of course.
Each area has its own controller, model, and view folders...