ASP.NET MVC - 什么是UrlRoutingModule? [英] ASP.NET MVC - What is UrlRoutingModule?

查看:172
本文介绍了ASP.NET MVC - 什么是UrlRoutingModule?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读有关MVC请求生命周期。我被困在了解下面一行。

I was reading about Request life cycle in MVC. I got stuck in understanding the below line.

该UrlRoutingModule截取该请求

The UrlRoutingModule Intercepts the Request

查询 - 什么是UrlRoutingModule

Query - What is UrlRoutingModule?

我搜索的谷歌了很多,但也没有发现任何有用

I searched a lot on google but could not found any useful

推荐答案

请求发送到基于MVC的ASP.NET Web应用程序首先通过 UrlRoutingModule 对象,这是一个HTTP模块。该模块解析请求,进行路由选择。该UrlRoutingModule对象选择当前请求匹配的第一个路由对象。 (路由对象是实现RouteBase一类,通常是Route类的一个实例。)如果没有路由匹配,UrlRoutingModule对象不执行任何操作,并允许该请求回落到正规的ASP.NET或IIS请求处理。

Requests to an ASP.NET MVC-based Web application first pass through the UrlRoutingModule object, which is an HTTP module. This module parses the request and performs route selection. The UrlRoutingModule object selects the first route object that matches the current request. (A route object is a class that implements RouteBase, and is typically an instance of the Route class.) If no routes match, the UrlRoutingModule object does nothing and lets the request fall back to the regular ASP.NET or IIS request processing.

从选定路由目的,UrlRoutingModule对象获得实现IRouteHandler接口和与该路线对象相关联的对象。通常情况下,在MVC应用程序,这将是MvcRouteHandler类的一个实例。该MvcRouteHandler实例创建实现IHttpHandler接口的MvcHandler对象。该MvcHandler对象然后选择,这将最终处理的请求的控制器。欲了解更多信息,请参见ASP.NET路由。

From the selected Route object, the UrlRoutingModule object obtains an object that implements the IRouteHandler interface and that is associated with the Route object. Typically, in an MVC application, this will be an instance of the MvcRouteHandler class. The MvcRouteHandler instance creates an MvcHandler object that implements the IHttpHandler interface. The MvcHandler object then selects the controller that will ultimately handle the request. For more information, see ASP.NET Routing.

该UrlRoutingModule和MvcRouteHandler类的入口点的ASP.NET MVC框架。他们执行以下操作:

The UrlRoutingModule and MvcRouteHandler classes are the entry points to the ASP.NET MVC framework. They perform the following actions:


  • 选择在MVC Web应用程序中相应的控制器。

  • Select the appropriate controller in an MVC Web application.

获取特定的控制器实例。

Obtain a specific controller instance.

呼叫控制器的Execute方法。

Call the controller's Execute method.

参考

这篇关于ASP.NET MVC - 什么是UrlRoutingModule?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆