MVC application folder structure
In the previous article, you have learned to create your first MVC application. In this article, we will focus on the folder structure of a basic MVC application. You have seen the following folder and files structure which was created by the Visual Studio.
Let's understand about them one by one.
App_Data stands for application data, which can contain various types of application data files. These files can be like XML file, .mdf file, Local Database(LocalDB) file etc.
App_start stand for application start, which basically contains the class files which gets executed when the application starts. Following are most important files.
- FilterConfig: Used to do the request filtering
- RuteConfig: Used to create the routes
- You need not worry about these files at the moment, we will discuss them in a very great detail in later articles.
Content folder contains the static files or the files which do not change frequently. These files can be CSS files, image files, font files, text files etc which can be used across the whole application.
Controller folder contains the controller class files. Controller classes are basically responsible to handle the user's request. These classes deal with the flow of the MVC application, they handle the data coming from the user and responds with a relevant View with a specific Model if required.
However you can put the fonts in the Content folder as well, here we have a separate folder to store the font files.
Models folder contains the entity classes, these classes further contains the different types of properties based on the requirement. Model classes manage the data which is used to represent the output using Views.
In this file, we can write the global events such as Application_BeginRequest, Application_Start, Application_Error, Session_Start, Session_End etc. These events run on the application level, global error or other global events can be handled from this page.