Introduction to ASP. NET MVC

Source: Internet
Author: User

The full name of MVC is the model View Controller, which is the abbreviation for the models-view-controller, a software design paradigm that organizes the code with a method of business logic, data, and interface display separation. Aggregating business logic into a single component does not require rewriting business logic while improving and personalizing the interface and user interaction. MVC is uniquely developed to map the traditional input, processing, and output functions in a logical graphical user interface structure.

MVC is one of three types of ASP.

The model layer represents the core of the application (such as a list of database records).

View (views layer) displays data (database records).

The controller (Director/layer) processes the input (writes to the database record).

Creating an MVC Program

New Project

ASP. NET MVC 4 WEB Application

Select template-control; view Engine-aspx

Click OK after the VS will automatically generate 5 folders and related profiles, the names of the five folders can not be changed, the corresponding sub-pages into the corresponding folder, in use do not need to indicate the folder name

App_Data folder

The App_Data folder is used to store application data.

Controllers folder

The Controllers folder contains the controller classes that are responsible for handling user input and the corresponding.

MVC requires that the names of all controller files end with "controller".

Models folder

The Models folder contains classes that represent the application model. The model controls and operates data for the application.

Views folder

The Views folder is used to store HTML files (user interface) related to the display of the application.

The Views folder contains a folder for each controller.

MVC Daily Use points:

1. Mvc needs to be generated frequently

2, can not display data between pages

3. Linq in Model, need to reference namespace when used

4. You cannot use the WebForm control on the view page of MVC

5, in the MVC view page with reference data or using C # code, you need to put in the <% code%>, named Control reference <% @important namespace= ""%>


C-Layer
Composed of motion in the controller and controller
The MVC request is not directly on the page, but instead sends a request to an action in the controller

Returns the index action under the home controller by default

If there is a requested controller, there is no request action, then the index action under the controller is returned by default

Introduction to ASP. NET MVC

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.