ASP.NET Web application is created with the MVC template and is auto generated by the Development Environment of Visual studio. Unlike any other framework MVC has very strict guidelines about where to place different elements like a Model should be in the Model Folder, the controller must be in the controller folder, View must be in the View folder and there’s more to it than that. If you put it a wrong place, your application might not work as you expected.
MVC is also created for the purpose of having a clean and organized coding technique. For further knowledge on how this folder is being used in this framework, let’s go down the line and make an overview of each element and folder in our solution explorer.
Note: <em>I’m using Visual Studio 2013</em>
(You can also see blog post How to start with MVC ASP.NET Web Application)
MVC Architecture C#
The image below is the folders and files generated for a newly created Visual Studio ASP.NET MVC Web Application project. Let’s see significance in each file in the solution explorer.
This folder contains application data like local Database used by the application like .mdf file. This folder doesn’t have special meaning in the MVC framework.
Content folder contains style sheet for your sites like Site.css.
This is the heart of MVC where you can find all the classes that are responsible for the processing of data. The controller is always tied to the View folder.
For example, if we have HomeController in the controller folder, then we also have a Home folder in the views folder and if we have AccountController in the controller folder then we also have Account Folder in the views folder. Home Controller must be named with a Controller at the end in order for it to work.
This folder contains User interface of your application. See image below.
Account, Home and Manage folder are the View of your Controller while Shared folder contains a template of your Web Application. _layout.cshtml, it’s like a master page and responsible of how all your pages will look like. _LoginPartial.cshtml contains code for partial menu .Error.cshtml is responsible for displaying error. View Start.cshtml it calls the default layout of the page which is _layout.cshtml. Web.config is an app configuration file that contains assemblies needed for the project.
Contains customize font you want to use in your project.
This folder contains classes that are responsible for the identification of data. This is where all application requirements are registered.
Favicon.ico -> default site logo icon
Packages.config -> this comes from nugget packages.
Web.config -> Configuration settings of your application
You can also refer to this link from DotNetmob.com for additional info on ASP.NET MVC Architecture.
Thank you for reading. Hope this helps. Enjoy Coding!!!