IIS如何知道一个请求是webforms还是MVC?(ASP.NET)

时间:2022-05-06 03:21:28

Short question:

短的问题:

How does IIS know if a request is webforms or MVC?

IIS如何知道一个请求是webforms还是MVC?

2 个解决方案

#1


19  

Short answer: IIS doesn't know; ASP.NET knows via HTTP Handlers

简单回答:IIS不知道;ASP。NET通过HTTP处理程序知道

Both WebForms and MVC are built on top of ASP.NET, and both use HTTP Handlers to deal with per-request execution:

WebForms和MVC都构建在ASP之上。NET,并且都使用HTTP处理程序来处理每个请求的执行:

  • WebForms has .aspx files mapped to the PageHandlerFactory
  • WebForms将.aspx文件映射到PageHandlerFactory
  • MVC integrates into the Routing infrastructure as an IRouteHandler implementation. Routes is notified of requests via the UrlRoutingHandler
  • 作为一个IRouteHandler实现,MVC集成到路由基础结构中。路由通过UrlRoutingHandler通知请求

ASP.NET, in turn, is notified of all requests in IIS7+ and via mapped file extensions in IIS6-

ASP。而NET则通过IIS7+和IIS6-中的映射文件扩展名通知所有请求

#2


3  

IIS doesn't know that. An url is parsed by ASP.NET (which is the base of both webforms as MVC) according to the settings in the web.config.

IIS并不知道。url由ASP解析。NET(作为MVC的两个webforms的基础)根据web.config中的设置。

#1


19  

Short answer: IIS doesn't know; ASP.NET knows via HTTP Handlers

简单回答:IIS不知道;ASP。NET通过HTTP处理程序知道

Both WebForms and MVC are built on top of ASP.NET, and both use HTTP Handlers to deal with per-request execution:

WebForms和MVC都构建在ASP之上。NET,并且都使用HTTP处理程序来处理每个请求的执行:

  • WebForms has .aspx files mapped to the PageHandlerFactory
  • WebForms将.aspx文件映射到PageHandlerFactory
  • MVC integrates into the Routing infrastructure as an IRouteHandler implementation. Routes is notified of requests via the UrlRoutingHandler
  • 作为一个IRouteHandler实现,MVC集成到路由基础结构中。路由通过UrlRoutingHandler通知请求

ASP.NET, in turn, is notified of all requests in IIS7+ and via mapped file extensions in IIS6-

ASP。而NET则通过IIS7+和IIS6-中的映射文件扩展名通知所有请求

#2


3  

IIS doesn't know that. An url is parsed by ASP.NET (which is the base of both webforms as MVC) according to the settings in the web.config.

IIS并不知道。url由ASP解析。NET(作为MVC的两个webforms的基础)根据web.config中的设置。