当前位置:网站首页>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 边栏推荐
- 【Golang】快速复习指南QuickReview(十)——goroutine池
- WinDbg loads mex DLL analysis DMP file
- 徽商期货交易软件正规吗?如何安全下载?
- Bypass memory integrity check
- ZABBIX monitoring - Aruba AP operation data
- 实现vscode写markdown文档+图片自动上传至腾讯云cos
- Use of paging components in fusiondesign
- Kubernetes resource topology aware scheduling optimization
- QPS fails to go up due to frequency limitation of public network CLB bandwidth
- [open source] goravel (golang Web Framework) - new cache module
猜你喜欢

Yaokui tower in Fengjie, Chongqing, after its completion, will be the safety tower for Sichuan river shipping with five local scholars in the company

Crise de 35 ans? Le volume intérieur est devenu synonyme de programmeur...

FPGA based electromagnetic ultrasonic pulse compression detection system paper + source file

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

Can the biggest gamefi crash victim survive the bear market in May| May Monthly Report

Use of the vs2022scanf function. An error is reported when using scanf - the return value is ignored: Solutions

小程序开发框架推荐
Implementing MySQL fuzzy search with node and express

Add two factor authentication, not afraid of password disclosure, let alone 123456

Kubernetes resource topology aware scheduling optimization
随机推荐
【Golang】快速复习指南QuickReview(六)——struct
Configure two databases in master-slave database mode (master and slave)
教你如何用网页开发桌面应用
Script tag attributes and & lt; noscript> label
Whether the offsetwidth includes scroll bars
Sharelist supports simultaneous mounting of Google drive/onedrive multiple network disks
Yukeng MySQL service installation error
How to solve the problem that the ID is not displayed when easycvr edits the national standard channel?
教你如何用网页开发APP
【白话技术】二维码
35 year old crisis? It has become a synonym for programmers
Applet development framework recommendation
JS regular ignore case
What cloud disk types does Tencent cloud provide? What are the characteristics of cloud disk service?
Which is better for securities companies? I don't understand. Is it safe to open an account online?
What is the role of short video AI intelligent audit? Why do I need intelligent auditing?
【Golang】跟着源码学技巧系列之对象池sync.Pool
Implementing MySQL fuzzy search with node and express
Eight misunderstandings, broken one by one (final): the cloud is difficult to expand, the customization is poor, and the administrator will lose control?
Command line add user set password never expires add remote group add administrator group