Introduction
Model–view–controller (MVC) is a software architecture,currently considered an architectural pattern used in software development.
The main aim of developing MVC framework is to support pattern-based application development. In other words, the framework was designed to make it easier to implement software design principles and patterns when building web applications.
The MVC application can be divided into Model, View, Controller-so this makes it easier to manage.
Now we'll create a MVC project which contains different files and folders gives a complete idea about MVC project structure.
Create a MVC project in Visual Studio: In the first step open visual studio 2013 and click on File ->New ->Project
Select Asp.Net Web Application from Templates->Visual C# ->Web (which you can see in New Project window at left pane) as shown below

Next select 'MVC' template under 'Select a template', please note that we are not selecting any other template. If you select MVC template, visual studio will create a sample application with Model-View-Controller architecture which has many features that enable fast and test driven development and also it uses bootstrap as template for layout. Bootstrap is an open source javascript framework and is a combination of HTML, CSS and jquery whcih allows the web application to fit on any size of screen in Desktop, Tablet or Mobile. It is used for developing responsive and mobile first applications on the web. It is also called 'Front-End-Frmaework'.

Once you click on 'OK' a project will be created with all required files and folders. Open 'Solution explorer' in visual studion where you can find diiferent folders with different files as shown below.

MVC Project Structure: By default, MVC project contains following folders.
App_Data, which is the physical store for data. This folder has the same role as it does in ASP.NET Web sites that use Web Forms pages.
Content, which is the recommended location to add content files such as cascading style sheet files, images, and so on. In general, the Content folder is for static files.
Controllers, which is the recommended location for controllers. The MVC framework requires the names of all controllers to end with "Controller", such as HomeController, LoginController, or ProductController.
Models, which is provided for classes that represent the application model for your MVC Web application. This folder usually includes code that defines objects and that defines the logic for interaction with the data store
Scripts, which is the recommended location for script files that support the application. By default, this folder contains ASP.NET AJAX foundation files and the jQuery library.
Views, which is the recommended location for views. This folder contains three subfolders: Account, Home, and Shared. The Account folder contains views that are used as UI for logging in and changing passwords. The Home folder contains an Index view (the default starting page for the application) and an About page view.
The Views folder contains a folder for each controller; the folder is named with the controller-name prefix. For example, if you have a controller named HomeController,the Views folder contains a folder named Home.
The Shared folder is used for views that are shared across multiple controllers. For example, you can put the Web application's master page in the Shared folder.
Alogn with above folders listed, an MVC Web application uses code in the Global.asax file to set global URL routing defaults, and it uses the Web.config file to configure the application.
Comments/Suggestions are invited. Happy coding......!
Comments Post a Comment