Folder Structure of MVC

It is very necessary to know about folder structure of MVC. It will help you to add file in the recommended folder.

App_Data – This folder contains data files like LocalDB, .mdf files, xml files etc.

App_Start – It contains class files which gets executed when application starts. Normally it is config files like BundleConfig.cs, AuthConfig.cs, FilterConfig.cs etc.

Content – It contains static files like css files, images and icon files.

Controllers – It contains class files which handle user's request and response. All the controller file name ends with Controller word like HomeController, LoginController, ProfileController etc.

Models – It contains model class files which handles database task.

Scripts – It contains scripts file like JavaScript, VBScript, JQuery etc.

Views – It contains HTML files. There may be separate folder for each controller. For HomeController.cs; there is Home folder inside View folder.

Shared - It is under view folder and it contains shared files like master page layout etc. Shared folder content can be accessed by any controller.

Some Important Files

Global.json – This file is used for add dependencies or add external projects reference into your current project. It specifies the path where system should search for dependency folder.

Project.json – Project.json file in core is used to define project metadata, compilation information and dependencies.

Global.asax – It allows you to write code at application level events such as Application_BeginRequest, application_start, application_error, sesson_start, sesson_end etc.

Package.config – It is managed by NuGet to keep track of what packages and versions you have installed in the application.

Web.config – It contains application level configuration.

In the next chapter, you will learn: UI, Layout, Master Page with Razor Syntax and CSS in ASP.NET MVC


Share your thought