ASP. NET MVC Learning path-2

Source: Internet
Author: User

This paper is to consolidate the foundation

To facilitate understanding of the MVC framework, we first create an empty ASP. NET MVC Template

Here is the project structure after creation

The role of each file or folder

App_Data Application Data---as the name implies is the folder where files or databases are placed

App_start Application Startup folder

Filterconfig Global Filter Configuration---Determine user login and permissions, Action, tamper, and so on.

Routeconfig Routing Configuration

Webapiconfig WEBAPI Configuration

 Public Static classWebapiconfig { Public Static voidRegister (httpconfiguration config) {config. Routes.maphttproute (Name:"Defaultapi", Routetemplate:"Api/{controller}/{id}", defaults:New{id =routeparameter.optional}); }    }

Registering a default route

Controllers, Models, views controller, model, view folder

Global file: Global.asax is a text file that provides globally available code. The code includes the application's event handlers, as well as session events, methods, and static variables. Sometimes the file is also called an application file.

 Public class MvcApplication:System.Web.HttpApplication    {        protectedvoid  Application_Start ()        {            Arearegistration.registerallareas ( );            Webapiconfig.register (globalconfiguration.configuration);            Filterconfig.registerglobalfilters (globalfilters.filters);            Routeconfig.registerroutes (routetable.routes);        }    }

New empty template Global file contains program-initiated methods

Packages.config package configuration, which marks the class library used in the project

The entire execution process

(Client) HTTP Request ---(Server App) Routing----- ViewResult --viewengine --andView -Response

The Web. config file places the globally configured XML file

ASP. NET MVC Learning path-2

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: 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.