首先,本文参考了不少东东,仅供Q_L_H自己使用,ZZ自己负责。先上一张全家福:

HttpModules and HttpHandlers

ASP.NET MVC 是 HttpHandler.

UrlRoutingModule 是 HttpModule, 在web.config里面注册。

UrlRoutingModule → MvcRouteHandler

MvcRouteHandler → MvcHandler

IHttpHandler IRouteHandler.GetHttpHandler(RequestContext requestContext)
   {
     return this.GetHttpHandler(requestContext);
   }

protected virtual IHttpHandler GetHttpHandler(RequestContext requestContext)
    {
      requestContext.HttpContext.SetSessionStateBehavior(this.GetSessionStateBehavior(requestContext));
      return (IHttpHandler) new MvcHandler(requestContext);
    }

MvcHandler → IController

private void ProcessRequestInit(HttpContextBase httpContext, out IController controller, out IControllerFactory factory)
    {
      HttpContext current = HttpContext.Current;
      if (current != null)
      {
        bool? nullable = ValidationUtility.IsValidationEnabled(current);
        if ((!nullable.GetValueOrDefault() ? 0 : (nullable.HasValue ? 1 : 0)) != 0)
          ValidationUtility.EnableDynamicValidation(current);
      }
      this.AddVersionHeader(httpContext);
      this.RemoveOptionalRoutingParameters();
      string requiredString = this.RequestContext.RouteData.GetRequiredString("controller");
      factory = this.ControllerBuilder.GetControllerFactory();
      controller = factory.CreateController(this.RequestContext, requiredString);
      if (controller != null)
        return;
      throw new InvalidOperationException(string.Format((IFormatProvider) CultureInfo.CurrentCulture, MvcResources.ControllerBuilder_FactoryReturnedNull, new object[2]
      {
        (object) factory.GetType(),
        (object) requiredString
      }));
    }

参考文章:

http://www.codeproject.com/Articles/595520/MvcRouteHandler-and-MvcHandler-in-ASP-NET-MVC-Fram

http://beletsky.net/2011/06/inside-aspnet-mvc-route-to-mvchanlder.html

http://msdn.microsoft.com/en-us/magazine/dd695917.aspx

最新文章

  1. 转载:Spring AOP (下)
  2. JS中跨域和沙箱的解析
  3. HTML插入地图的方法
  4. PHP时间日期
  5. LeetCode: Lowest Common Ancestor of a Binary Search Tree 解题报告
  6. Report_报表中Ref Cursor数据源的概念和用法(案例)
  7. 修改Win7远程桌面端口
  8. Josephina and RPG
  9. Web移动端Fixed布局的解决方案
  10. 基于纹理边缘抑制的轮廓和边界检测(Contour and Boundary Detection)
  11. 配置F5 负载均衡(转)
  12. javascript深入理解js闭包(转载)
  13. python之模块、包的导入过程和开发规范
  14. Luogu3676 小清新数据结构题(树链剖分+线段树)
  15. Flex 布局教程转载
  16. ab,qps 并发连接数
  17. jsp里面不能使用${pageContext.request.contextPath}解决方案
  18. 【胡思乱想】JNI与线程池的维护
  19. [原]F5负载均衡激活license
  20. 用js内置对象XMLHttpRequest 来用ajax

热门文章

  1. JavaScript input file上传前获取文件名、文件类型、文件大小等信息
  2. eq相等 ne、neq不相等, gt大于, lt小于 gte、ge大于等于 lte、le 小于等于 not非 mod求模 等
  3. 手机wifi密码的保存位置
  4. ExtJS学习之路第三步:理解引擎之下,ExtJS4中的类
  5. javaScript模块化规范ADM与CMD
  6. NGUI 新版操作教程
  7. 正则匹配之url的匹配
  8. dell idrac8 部署操作系统的方法
  9. django migration使用指南
  10. 局域网所有机器都能连接MySQL数据库的设置命令