组件下载地址 haacked.com

1、在mvc项目中引入组件

2、配置route规则

public static void RegisterRoutes(RouteCollection routes)
{
//routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
//忽略About页面,不能将它已到mapRoute后面,改方法不是有Route组件提供是System.Web.Mvc下的方法
//routes.IgnoreRoute("Home/About"); routes.MapRoute(
"Default", // 路由名称
"{controller}/{action}/{id}", // 带有参数的 URL
new { controller = "Home", action = "Index", id = UrlParameter.Optional }, // 参数默认值
new { controller=@"^\w+",action=@"^\w+"}
); routes.MapRoute(
"Filter", // 路由名称
"{controller}/{action}/{id}", // 带有参数的 URL
new { controller = "Filter", action = "Index", id = UrlParameter.Optional }, // 参数默认值
new { controller = @"^\w+", action = @"^\w+" }
); routes.MapRoute(
"car",
"Car/{make}/{pro}",
new {controller="Car",action="Index",id=}
); routes.MapRoute(
"Archive",
"Archive/{date}",
new { controller = "blog", action = "Archive" },
new {date=@"^\d{4}-\d{2}-\d{2}" } ); routes.MapRoute(
"Book",
"Book/Add/{name}",
new { controller = "Book", action = "Add" },
new { HttpMethod="Post"}
); routes.MapRoute(
"Product",
"Product/{*value}",//*表示匹配一切内容
new {controller="Product",action="Index" }
); /*Dictionary<string, object> defaultRout = new Dictionary<string, object>();
defaultRout["action"] = "Index";
defaultRout["id"] = 0; RouteValueDictionary defaultRouteValue = new RouteValueDictionary(defaultRout); RouteValueDictionary constrainRouteValue = new RouteValueDictionary();
constrainRouteValue["controller"] = @"\w+";
constrainRouteValue["id"] = @"\d+"; Route route = new Route("{controller}/{action}/{id}", defaultRouteValue, constrainRouteValue, new MvcRouteHandler());*/
}

3、在Global.asax.cs代码中写入

   protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

RegisterRoutes(RouteTable.Routes);
            //设为true表示url指向磁盘上的物理文件也会进行url routing处理,例如一个普通的html页面
            RouteTable.Routes.RouteExistingFiles = true;
            RouteDebug.RouteDebugger.RewriteRoutesForTesting(RouteTable.Routes);
            
        }

MVC 路由检测组件 Routing Debugger的更多相关文章

  1. asp.net mvc 路由检测工具

    初学mvc,路由搞不清楚,可以通过一款插件 查看匹配的路由. 工具名<RouteDebugger> 可以在nuget中查询RouteDebugger后,安装.或者在控制台进行安装: pm& ...

  2. 返璞归真 asp.net mvc (2) - 路由(System.Web.Routing)

    原文:返璞归真 asp.net mvc (2) - 路由(System.Web.Routing) [索引页] [源码下载] 返璞归真 asp.net mvc (2) - 路由(System.Web.R ...

  3. ASP.NET MVC 路由(一)

    ASP.NET MVC路由(一) 前言 从这一章开始,我们即将进入MVC的世界,在学习MVC的过程中在网上搜索了一下,资料还是蛮多的,只不过对于我这样的初学者来看还是有点难度,自己就想看到有一篇引导性 ...

  4. Asp.Net MVC 3【URLs, Routing,and Areas】续

    http://www.cnblogs.com/HuiTai/archive/2012/07/24/2597875.html 接着前面继续学习分享我们的路由. 现在我们把Global.asax文件里的R ...

  5. 【ASP.NET MVC系列】浅谈ASP.NET MVC 路由

    ASP.NET MVC系列文章 [01]浅谈Google Chrome浏览器(理论篇) [02]浅谈Google Chrome浏览器(操作篇)(上) [03]浅谈Google Chrome浏览器(操作 ...

  6. MVC路由解析---MapRoute

    文章引导 MVC路由解析---IgnoreRoute MVC路由解析---MapRoute MVC路由解析---UrlRoutingModule Area的使用 引言 前面我们讲了IgnoreRout ...

  7. ASP.NET路由[ASP.NET Routing]

    ASP.NET路由[ASP.NET Routing] ASP.NET路由允许你在使用URL时不必匹配到网站中具体的文件,因为这个URL不必匹配到一个文件,你使用了描述用户行为且更容易被用户理解的URL ...

  8. MVC 路由介绍

    我们新建一个ASP.NET MVC Web程序的时候,会生成一个Global.asax文件.如下: using System; using System.Collections.Generic; us ...

  9. MVC路由探寻,涉及路由的惯例、自定义片段变量、约束、生成链接和URL等

    引子 在了解MVC路由之前,必须了解的概念是"片段".片段是指除主机名和查询字符串以外的.以"/"分隔的各个部分.比如,在http://site.com/Hom ...

随机推荐

  1. STL源码剖析--迭代器(转)

    一.为什么需要traits编程技术 前面说了很多关于traits的光荣事迹,但是却一直没有介绍traits究竟是个什么东西,究竟是用来干什么的?traits在英文解释中就是特性,下面将会引入trait ...

  2. 在Linux x86_64环境下编译memcached

    Memcached 是一个高性能的分布式内存对象缓存系统,用于动态Web应用以减轻数据库负载.它通过在内存中缓存数据和对象来减少读取数据库的次数,从而提供动态.数据库驱动网站的速度.Memcached ...

  3. ConcurrentHashMap原理详解

    参考链接:https://www.cnblogs.com/chengxiao/p/6842045.html https://www.cnblogs.com/ITtangtang/p/3948786.h ...

  4. ios中的奇怪崩溃Signal和EXC_BAD_ACCESS错误分析

    什么是Signal 在计算机科学中,信号(英语:Signals)是Unix.类Unix以及其他POSIX兼容的操作系统中进程间通讯的一种有限制的方式.它是一种异步的通知机制,用来提醒进程一个事件已经发 ...

  5. C++学习笔记-关键词

    1.friend友元 采用类的机制后实现了数据的隐藏与封装,类的数据成员一般定义为私有成员,成员函数一般定义为公有的,依此提供类与外界间的通信接口.但是,有时需要定义一些函数,这些函数不是类的一部分( ...

  6. github的使用 sourceTree

    http://www.cnblogs.com/Jenaral/p/5655958.html

  7. 5.mybatis 多参数传递 -分页

    需求 :分页   方法一:使用下标来进行赋值,下标从零开始 mapper.xml <select id="selectByPage" resultMap="blog ...

  8. 实施MySQL ReplicationDriver支持读写分离

    MySQL 提供支持读写分离的驱动类: com.mysql.jdbc.ReplicationDriver 替代 com.mysql.jdbc.Driver 注意,所有参数主从统一: jdbc:mysq ...

  9. 【Leetcode】Largest Rectangle in Histogram

    Given n non-negative integers representing the histogram's bar height where the width of each bar is ...

  10. 2017年6月15日 由一个freemarker出错引发的感想

    今天想要实现一个功能,想要实现遍历多个checkbox的功能.想出一个解决方法用了30秒钟,将包含的键值put进map中,前台根据map[key]??判断是否具有该值,乍一看这个方法很好,可是实际上问 ...