Login

Username:

Password: 

Join us Now |  Forgot Password? | Forgot UserName?

Asp.Net MVC

Learn step by step



MVC Folders

ASP.NET MVC web application has the following folder content:



Application information

  • Properties
  • References

Application folders

  • App_Data Folder
  • App_Start Folder
  • Content Folder
  • Controllers Folder
  • Models Folder
  • Scripts Folder
  • Views Folder

Configuration files

  • Global.asax
  • packages.config
  • Web.config

MvcApplication – A Project Name

This is the name for a one project. It is include in the solution we just explained above. In this project we have direct sub folders and or files. The sub-folder we would now briefly describe below.

Application information
Properties

This is where we have details information related to our project which helps in differently recognize it. It is sort of same as a meta file for our project.

References

In references to other projects in our solution and DLL dependencies which we our project require to run.

Application folders
App_Data Folder

In this folder where you can save data associated to your website. Almost of the time you people use it to save portable file-based databases example .mdf file.

App_Start Folder

The app start is like of a special folder in that by default it include different configuration files. Below are the default files in it upon making a new project.


Content Folder

This folder include Cascading Style Sheet(css) files and images. Content folder is used for static and publically servable files (*.css).


Controllers Folder

This folder include C# classes files that are controller classes. Controllers are liable for manage end user communication, manipulating the model and selecting a view to showing the UI. Every controller class inherits a Controller class or IController interface. Every controller class name has "Controller" as a suffix on the class name.


It is simply a suggestion. It builds no difference whether we put controllers directly into this folder, a subfolder or everywhere else in the whole project or into other referenced project or assembly. Because we aware of that these are classes and all of them are compiled into the same assembly.

Models Folder

This folder carry classes that explain objects and the logic for communicating with the database or data items. The Model is used by the Controller and the View to view and change.


It is good to set model classes into a different class library project.

Scripts Folder

The Scripts folder is the suggested folder to save Java Script files in our MVC web application. We set static and publicly accessible files for Java Script and jQuery validation files (*.js) in this folder.


Views Folder

This folder contains views (*.ascx, *.aspx and *.cshtml files). It is where files for showing the application's user interface are placed. The Views folder carry a subfolder for every Controller and Views for the Controller action results. The sub folder View's is named with the controller-name-prefix and View is named with the controller action.


The Views folder hold a Web.config file. It is not our application's head Web.config file. It hold a directive inform the web server not to serve any *.aspx files under /Views because they should be rendered by a controller, not include directly like Web Forms (*.aspx files). It also hold the configuration that is required to construct the standard ASP.NET ASPX pages compiler work nicely with ASP.NET MVC view syntax.

Views\Shared

The Shared folder is a subfolder of the Views folder. It used for many views. It carry Error Pages, global Master Pages and User Controls used by many controllers. This folder is not related with any specific Controller.


Configuration files
Global.asax file

In Global.asax file, you have project vast settings registration. Anyone configurations you have made in your application are registered or de-registered in this file.

Packages.config file

This file is where your referenced packages in references are explains. For example version numbers of referenced packages across with their .net targets are complete in this file.

Web.config file

Within of the web.config file is where you save other setting which you required to change without recompiling your code. It is an xml file so does not required compilation. You can also save information like connection strings for your databases, membership contributor for website authentication e.t.c.




Related Videos