当前位置:网站首页>ASP. Net MVC and asp Net web form
ASP. Net MVC and asp Net web form
2022-06-23 20:55:00 【conanma】
1 ASP.NET MVC
It is provided by Microsoft MVC Pattern based ASP.NET Web Application development framework .
MVC The modes are :
Model: Domain model Process the logical part of the application data , get data , Processing data
View: View Used to process the pages actually returned to the user
Controller: controller adopt Model Read and process data , adopt View Return the result .
2 ASP.NET Webform
stay ASP.NET A development mode based on event model under the framework , Fast development speed , Easy to use .
3 The difference between the two and their respective advantages and disadvantages
ASP.NET As a Microsoft Web Program development framework ,MVC And Webform It is the development mode in different periods ,
stay ASP.NET Operation processing principle Almost the same .
Webform advantage : Can be developed based on the event model , similar Winform in , All requests use ViewState And page lifecycle to maintain control state , At the same time, control development , Speed up development , whole Webform The internal packaging of is relatively high .
Webform shortcoming : Because of the high degree of encapsulation ,Webform Very difficult to expand , It is convenient for developers to understand the internal operation principle , Not easy to test . Concurrent control ViewState Increase the transmission volume of the website server , To some extent, it will affect the efficiency of the program .
MVC advantage : extensible , Easy to unit test , Easy test driven development .MVC The existence of a route in , You can do some pseudo static processing of links .
summary : MVC Instead of Webform, Both are applicable to different development environments , They are the development framework of the presentation layer in the simple three layers , All are ASP.NET Development mode under the framework .
1 Page processing flow : MCV The page processing flow of is still ASP.NET There are extensions on the original ,MVC Through a specific IHttpModule and IHttpHandler To process requests , And Webform Different ,Webform Each of them aspx Every page will have a IHttphandler example .MVC in Controller All than yes IHttpHandler Subclass instances of ,Action Is in MvcHandler Pass through MVC The factory reflection of ,MvcHandler You can customize .
2 Context Request object : Context Session Request Response Cookie Almost the same
3 The configuration files are basically the same , But it's not universal
4 Some server controls are not disabled MVC Use in
5 stay ASP.NET MVC in , Include Membership,healthMonitoring,httpModule,trace Built in and custom component modules are still available .
The appended drawings :MVC Schematic diagram and introduction
123123123.jpg
1 The client sends a request to IIS(mvc Is the integration mode ), perform HttpRunTime Of ProcessRequest Method
2 Created a batch of MvcApplication object , Stored in the application pool , Execute the first MvcApplication In the object instance Application Of Application_Start() Method 、
RouteConfig.RegisterRountes(RouteTable.Routes)--> Register a default routing rule with the routing rule set
3 call Application Object instance ProcessRequest Method , Pass in the context object HttpContext, Start execution 19 Pipeline events
4 The seventh pipeline event :
UrlRouting filter :
1 Get current Reuqest Object RawUrl: here /Home/Index
2 To scan the current set of routing rules , Match from top to bottom , The match was successful --{controller}/{action}/{id} This routing rule ,MVC The bottom layer will resolve the controller name according to the routing rules
HomeController action:Index
3 call DefaultControllerFactory Reflection creates an object instance of the controller class , Deposit in RemapHandler in
4 take Controller and action The name is stored as a string RouteData in 5 The eighth pipeline event
1 Judge the present RemapHandler Is it null, Not for null Directly skip the pipeline event after execution 2 by null Continue to create page class objects
6 The eleventh , Twelve pipeline events
1 Get context RemapHandler Object instance of the controller class in
2 from RoutData Get the current request from the action name
3 Execute dynamically in a reflective manner action Method
4 action The return types are divided into :
4.1 If it is a view type : Call specific view (.cshtml) Compile into page classes , When calling the Excute() Method , Write all the code to after execution Response in
4.2 If it is a non view type , Write the results directly to Response Then you can 边栏推荐
- [SAP ABAP] call API interface instance
- Can the biggest gamefi crash victim survive the bear market in May| May Monthly Report
- JS takes two decimal places
- [open source] goravel (golang Web Framework) - new cache module
- [golang] use go language to operate etcd - configuration center
- JS five methods to judge whether a certain value exists in an array
- 【白话技术】二维码
- Fortress deployment server setup operation guide for novices
- This article introduces you to the necessity of database connection pooling
- The substring() method in. JS can be used to intercept all characters after the specified string
猜你喜欢

Syntax of SQL union query (inline, left, right, and full)

重庆 奉节耀奎塔,建成后当地连中五名进士,是川江航运的安全塔

Rstudio 1.4 software installation package and installation tutorial

After the collapse of UST, will the stable currency market pattern usher in new opportunities?

Applet development framework recommendation

Importance and purpose of test

Eight misunderstandings, broken one by one (final): the cloud is difficult to expand, the customization is poor, and the administrator will lose control?

「开源摘星计划」Containerd拉取Harbor中的私有镜像,云原生进阶必备技能

小程序开发框架推荐

LeetCode 260. Number III that appears only once
随机推荐
OHOS LTS 3.0移植到RaspberryPi 4B
Is it safe for Huatai Securities to open an account online for securities companies with low handling fees and commissions
Rstudio 1.4 software installation package and installation tutorial
Want to open an account, is it safe to open an account on the stock Internet? Will the funds be cheated away?
Cobalt Strike Spawn & Tunnel
Syntax of SQL union query (inline, left, right, and full)
Technology sharing | wvp+zlmediakit realizes streaming playback of camera gb28181
35 year old crisis? It has become a synonym for programmers
Can Tencent cloud disk service share data? What are the advantages of cloud disk service?
Install bitgarden open source password manager
[SAP ABAP] call API interface instance
Kinsoku Jikou Desu Sina stock interface change
Fortress deployment server setup operation guide for novices
How to build a personal cloud game server? How many games can the cloud game platform install?
Configure two databases in master-slave database mode (master and slave)
How to solve the problem of large traffic audio audit? What are the common approval methods?
Newbeecoder. UI new open source control library DataGrid instructions
[golang] some questions to strengthen slice
数字化采购转型解决方案:SaaS采购管理平台推进企业阳光采购
手续费佣金低的券商,华泰证券网上开户安全吗