mvc 中路由可以自定义

public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.AppendTrailingSlash = true;
routes.LowercaseUrls = true;
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute("MvcPager_PageSize", "{controller}/{action}/{pagesize}/{pageindex}", new { controller = "Demo", action = "PageSize", pageindex = UrlParameter.Optional }, new { action = "PageSize", pagesize = @"\d*", pageindex = @"\d*" });
routes.MapRoute("MvcPager_Default", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = UrlParameter.Optional }, new { id = @"\d*" });
routes.MapRoute("MvcPager_SEO", "{controller}/{action}/page_{id}", new { controller = "Demo", action = "FirstPageUrl", id = 1 }, new { action = "FirstPageUrl", id = @"\d*" });
routes.MapRoute("MvcPager_Pager1", "{controller}/{action}/page_{pageindex}", new { controller = "Demo", action = "CustomRouting", pageindex = 1 }, new { action = "CustomRouting", pageindex = @"\d*" });
routes.MapRoute("MvcPager_Pager2", "{controller}/{action}/pageindex-{pageindex}", new { controller = "Demo", action = "CustomRouting", pageindex = 1 }, new { action = "CustomRouting", pageindex = @"\d*" });
routes.MapRoute("MvcPager_Pager3", "{controller}/{action}/p-{pageindex}", new { controller = "Demo", action = "CustomRouting", pageindex = 1}, new { action = "CustomRouting", pageindex = @"\d*" });

}
}

C# asp.net mvc 配置多个route 参数的更多相关文章

  1. 【ASP.NET MVC 牛刀小试】 URL Route

    例子引入 先看看如下例子,你能完全明白吗? using System; using System.Collections.Generic; using System.Linq; using Syste ...

  2. ASP.NET MVC 页面调整并传递参数

    转自:http://blog.csdn.net/zhensoft163/article/details/7174661 使用过ASP.NET MVC的人都知道在MVC中页面后台中常用的页面跳转方法有几 ...

  3. ASP.NET MVC:Expression Trees 作为参数简化查询

    ASP.NET MVC 引入了 ModelBinder 技术,让我们可以在 Action 中以强类型参数的形式接收 Request 中的数据,极大的方便了我们的编程,提高了生产力.在查询 Action ...

  4. ASP.NET MVC 请求流程:Route

    1.RouteTable RouteTable翻译过来的意思就是路由表,一个Web应用程序具有一个全局的路由表,该路由表通过System.Web.Routiing.RouteTable的静态只读属性R ...

  5. asp.net mvc源码分析-Route的GetRouteData

    我知道Route这里东西应该算路由,这里把它放到mvc里面有些不怎么合适,但是我想大家多数遇到路由都是在mvc的时候吧.首先我们还是来看看GetRouteData方法吧 [csharp] public ...

  6. ASP.NET/MVC 配置log4net启用写错误日志功能

    <?xml version="1.0" encoding="utf-8"?> <!-- 有关如何配置 ASP.NET 应用程序的详细信息,请访 ...

  7. asp.net mvc 配置ckeditor4.x

    下载地址:https://ckeditor.com/ckeditor-4/download/ 一.使用方法: 1.在页面中引入ckeditor核心文件ckeditor.js 2.在使用编辑器的地方插入 ...

  8. C# ASP.NET MVC 配置允许跨域访问

    在web.config文件中的 system.webServer 节点下 增加如下配置 <httpProtocol> <customHeaders> <add name= ...

  9. ASP.NET MVC配置Redis服务

    ===================== 1.下载并安装Redis.官网并未提供Windows安装版,所以去Github 下载 下载地址: https://github.com/MicrosoftA ...

随机推荐

  1. PLSQL Developer win7 64位 安装方法

    安装32位的Oracle客户端( instantclient-basic-win32-11.2.0.1.0).Win7 64位系统暂无PLSQLDeveloper,所以下一个32位的. 下载insta ...

  2. [No000066]python各种类型转换-int,str,char,float,ord,hex,oct等

    int(x [,base ]) #将x转换为一个整数 long(x [,base ]) #将x转换为一个长整数 float(x ) #将x转换到一个浮点数 complex(real [,imag ]) ...

  3. python-day02数据类型-字符串和列表的操作

    while循环: while True: 条件语句....... 关于break和continue,break:跳出当前的循环                               contnu ...

  4. ISAPI_Rewrite中文手册

    参考:http://blog.csdn.net/fanxiaojie119/article/details/5353186 第一章:软件介绍ISAPI_Rewrite 是一款适用于IIS的功能强大的基 ...

  5. indows 8上强制Visual Studio以管理员身份运行

    http://diaosbook.com/Post/2013/2/28/force-visual-studio-always-run-as-admin-on-windows-8 Windows 8的一 ...

  6. c++ 头文件

    可以将程序分为二部分: 头文件:包含结构声明和使用这些结构的函数的原型 源代码文件: 包含与结构有关的函数的代码 不要将函数的定义或变量的声明放在头文件里, 一般头文件可以包含以下内容 >函数原 ...

  7. 产品列表页分类筛选、排序的算法实现(PHP)

    一.简单的单条件查询 工作都是从简单的开始,先从最简单的单表查询开始,这个一般用在首页以及一些比较独立的页面,只需要查找几个符合条件的产品展示出来即可,可以使用分页或者不使用分页.下面这个是产品控制器 ...

  8. 45个JavaScript小技巧

    原文地址 http://modernweb.com/2013/12/23/45-useful-javascript-tips-tricks-and-best-practices/ 这篇文章的质量个人感 ...

  9. DTCMS插件的制作实例电子资源管理(二)Admin后台页面编写

    总目录 插件目录结构(一) Admin后台页面编写(二) 前台模板页编写(三) URL重写(四) 本实例旨在以一个实际的项目中的例子来介绍如何在dtcms中制作插件,本系列文章非入门教程,部分逻辑实现 ...

  10. 通向高可扩展性之路(WhatsApp篇)---- 脸书花了190亿买来的WhatsApp的架构

    原文链接:http://highscalability.com/blog/2014/2/26/the-whatsapp-architecture-facebook-bought-for-19-bill ...