Loading page...
November 30, 2016
Sathishkumar Mohan
Applications designed using the MVC Pattern separate the Model from Presentation and Business Layer. ASP.Net makes this logical separation to be implemented physically by creating folder structures in project as Models, Controllers and Views.
Introduction
Applications designed using the MVC Pattern separate the Model from Presentation and Business Layer. ASP.Net makes this logical separation to be implemented physically by creating folder structures in project as Models, Controllers and Views.
An application many times contains large number of Controllers and Views, which makes it difficult to search and manage files. ASP.Net MVC provides a way to separate large applications into smaller units or functional grouping using Areas. An Area itself contains a MVC folder structure for adding controllers, models and views.
For example, a website can contain two modules such as Blogs and Forum apart from the main site. The Blog and Forum modules can be created as two separate Areas within the same application. Thus enabling separation and grouping of functionalities within the Area.
The complexity doesn’t stop here. At times we would require such separation in assembly level by having separate DLL for each Area, so that any changes can be done separately and deployed without the need for full site publish. Or we might want to add a new module to an existing MVC site which was deployed a year ago and we do not want to disturb the existing build.
In such cases we could create a separate project for an Area and deploy it. Thus using the existing authentication, authorization and resources of the main site.
Steps for creating a separate project for an AREA in ASP.Net MVC
Using this approach, we have created a separate Area for “Blog” and plugged it in to the main site. You will also notice that Master Page / Layout page and other resources of the main website are been reused without duplicating, thus maintaining the look and feel of the site. Use this approach to modularise your code while making is relatively easier to maintain and enhance in the future.
