当前位置:网站首页>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] delving into strings -- from byte run string to unicode and UTF-8
- JS five methods to judge whether a certain value exists in an array
- How do I close and restore ports 135, 139 and 445?
- 国内期货开户怎么开?哪家期货公司开户更安全?
- JS namespace
- Syntaxe des requêtes fédérées SQL (inline, left, right, full)
- How to build a personal cloud game server? How many games can the cloud game platform install?
- Short video intelligent audit software intelligent audit or manual audit
- 实现vscode写markdown文档+图片自动上传至腾讯云cos
- Pathname attribute of link a object
猜你喜欢

JS高级程序设计第 4 版:生成器的学习

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

35 year old crisis? It has become a synonym for programmers

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

Syntaxe des requêtes fédérées SQL (inline, left, right, full)

Daily question brushing record (II)

SQL聯合查詢(內聯、左聯、右聯、全聯)的語法

JS advanced programming version 4: generator learning

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

Can the biggest gamefi crash victim survive the bear market in May| May Monthly Report
随机推荐
How to deal with product pictures? How to select mapping software?
Emmet语法规范
Teach you how to develop desktop applications with web pages
Postman tutorial - teach you API interface testing by hand
国内期货开户怎么开?哪家期货公司开户更安全?
Pathname attribute of link a object
How to make a commodity price tag
Add two factor authentication, not afraid of password disclosure, let alone 123456
JS mailbox regular expression
Command line add user set password never expires add remote group add administrator group
35 year old crisis? It has become a synonym for programmers
LeetCode 260. Number III that appears only once
How to deal with unclear pictures? What are the techniques for taking clear pictures?
Configure two databases in master-slave database mode (master and slave)
手续费佣金低的券商,华泰证券网上开户安全吗
Realize vscode to write markdown documents + pictures to be automatically uploaded to Tencent cloud cos
December 29, 2021: the elimination rules of a subsequence are as follows: 1. In a subsequence
[golang] some questions to strengthen slice
FPGA based electromagnetic ultrasonic pulse compression detection system paper + source file
Yaokui tower in Fengjie, Chongqing, after its completion, will be the safety tower for Sichuan river shipping with five local scholars in the company