Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

ASP.

NET MVC Tutorials:


ASP.NET is a free web framework for building websites and web applications on .NET Framework
using HTML, CSS, and JavaScript.

ASP.NET MVC 5 is a web framework based on Mode-View-Controller (MVC) architecture


Developers can build dynamic web applications using ASP.NET MVC framework  The MVC (Model-View-
Controller) is an application development pattern or design pattern which separates an application into

three main components:

1. Model

2. View

3. Controller

Model

Model: Model is a part of the application which implements the logic for the data domain of the application. It is used to
retrieve and store model state in a database such as SQL Server database. It also used for business logic separation from
the data in the application.

Or

Model: Model represents the shape of the data. A class in C# is used to describe a model. Model
objects store data retrieved from the database.

View

View: View is a component that forms the application's user interface. It is uses to create web pages
for the application. An example would be an edit view of a Products table that displays text boxes,
drop-down lists and check boxes based on the current state of a Product object.

or

View: View in MVC is a user interface. View display model data to the user and also enables them
to modify them. View in ASP.NET MVC is HTML, CSS, and some special syntax (Razor syntax) that
makes it easy to communicate with the model and the controller.

Controller

interaction It works with the model and selects the


Controller: Controller is the component which handles user
view to render the web page. In an MVC application, the view only displays information whereas
the controller handles and responds to the user input and requests.

The following image represents the ASP.NET MVC Design Pattern:=

Or
This design pattern is a lightweight framework which is integrated with various features such as master pages and
membership based authentication. It is defined in the System.Web.Mvc assembly.

or

Controller: The controller handles the user request. Typically, the user uses the view and raises
an HTTP request, which will be handled by the controller. The controller processes the request and
returns the appropriate view as a response.

The following figure illustrates the interaction between Model, View, and Controller.

MVC Architecture

The following figure illustrates the flow of the user's request in ASP.NET MVC.

Request Flow in MVC Architecture


As per the above figure, when a user enters a URL in the browser, it goes to the
webserver and routed to a controller. A controller executes related view and models for
that request and create the response and sends it back to the browser.

 Points to Remember

1. MVC stands for Model, View and Controller.


2. Model represents the data
3. View is the User Interface.
4. Controller is the request handler.

ASP.NET MVC Version History


Microsoft had introduced ASP.NET MVC in .NET 3.5, since then lots of new features have been
added.

The following table list brief history of ASP.NET MVC.

Visual .NET Released


MVC Version Studio Framework Date Features
MVC 1.0 VS2008 .Net 3.5 13-Mar-2009  MVC architecture with webform engine
 Routing
 HTML Helpers
 Ajax Helpers
 Auto binding

MVC 2.0 VS 2008, .Net 3.5/4.0 10-Mar-2010  Area


 Asynchronous controller
 Html helper methods with lambda expression
 DataAnnotations attributes
 Client side validation
 Custom template
 Scaffolding

MVC 3.0 VS 2010 .Net 4.0 13-Jan-2011  Unobtrusive javascript validation


 Razor view engine
 Global filters
 Remote validation
 Dependency resolver for IoC
 ViewBag

MVC 4.0 VS 2010 SP1, .NET 4.0/4.5 15-Aug-2012  Mobile project template
VS 2012  Bundling and minification
 Support for Windows Azure SDK

MVC 5.0 VS 2013 .NET 4.5 17-oct-2013  Authentication filters


 Bootstrap support
 New scaffolding items
 ASP.Net Identity

MVC 5.2 - VS 2013 .NET 4.5 28-Aug-2014  Attribute based routing


Current  bug fixes and minor features update
Advantages of ASP.NET MVC Framework
This approach provides the following advantages.

o It manages application complexity by dividing an application into the model, view and controller.

o It does not use view state or server-based forms. This makes the MVC framework ideal for developers who want
full control over the behavior of an application.
o It provides better support for test-driven development.

o It is suitable for large scale developer team and web applications.

o It provides high degree of control to the developer over the application behavior.

Difference between ASP.NET WebForms and ASP.NET


MVC

Asp.Net Web Forms Asp.Net MVC


Asp.Net Web Form has server controls. Asp.Net MVC has HTML helpers.
Asp.Net Web Form follows Web Forms Syntax Asp.Net MVC follow customizable syntax (Razor as default)
Asp.Net Web Form is not Open Source. Asp.Net Web MVC is an Open Source.
It supports the Test Driven Programming model It supports the Event Driven Programming model that
preserves state over the HTTP.
There is no event in MVC. he Web Forms-based application provides many events and
also is supported in many server controls.
It uses the Front Controller pattern that process all requests it uses the Page Controller pattern that adds functionality to
through a single controller. individual pages.
VC does not support view state. It supports view state on server based forms that can help
us to manage state information.
MVC supports Separation of Concerns (SoC) that provides Web forms support Rapid Application Development (RAD).
the highly organized code structure. In MVC all three parts The components are tightly integrated.
can be developed and worked independently.
MVC has no specific page life cycle. All individual There is a specific page life cycle in the web form page.
components (such as Model, View and Controller) have their
own life cycle.

ASP.NET MVC Project


1. Create a Web Project

Click on file menu from the menu bar and select new submenu to create a new project. The following image show
that how to create a new project.
2. Select Project Type

Here, select type of project as a web project and provide name of the project.

3. Select MVC template

After selecting project type, now select the web template that we want to implement. Since we are working on
MVC then select MVC template from the list of available template. At the same time, provide the authentication
type to the application.
After clicking ok, it creates a project that has following structure:

4. MVC Web Application Project Structure

Following is the project structure that we just created.


1.Properties = it contain assembling information

2.Refernces = The Location where we add and config the refrence that are
required for our application

You might also like