C# asp.net mvc 配置多个route 参数
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 参数的更多相关文章
- 【ASP.NET MVC 牛刀小试】 URL Route
例子引入 先看看如下例子,你能完全明白吗? using System; using System.Collections.Generic; using System.Linq; using Syste ...
- ASP.NET MVC 页面调整并传递参数
转自:http://blog.csdn.net/zhensoft163/article/details/7174661 使用过ASP.NET MVC的人都知道在MVC中页面后台中常用的页面跳转方法有几 ...
- ASP.NET MVC:Expression Trees 作为参数简化查询
ASP.NET MVC 引入了 ModelBinder 技术,让我们可以在 Action 中以强类型参数的形式接收 Request 中的数据,极大的方便了我们的编程,提高了生产力.在查询 Action ...
- ASP.NET MVC 请求流程:Route
1.RouteTable RouteTable翻译过来的意思就是路由表,一个Web应用程序具有一个全局的路由表,该路由表通过System.Web.Routiing.RouteTable的静态只读属性R ...
- asp.net mvc源码分析-Route的GetRouteData
我知道Route这里东西应该算路由,这里把它放到mvc里面有些不怎么合适,但是我想大家多数遇到路由都是在mvc的时候吧.首先我们还是来看看GetRouteData方法吧 [csharp] public ...
- ASP.NET/MVC 配置log4net启用写错误日志功能
<?xml version="1.0" encoding="utf-8"?> <!-- 有关如何配置 ASP.NET 应用程序的详细信息,请访 ...
- asp.net mvc 配置ckeditor4.x
下载地址:https://ckeditor.com/ckeditor-4/download/ 一.使用方法: 1.在页面中引入ckeditor核心文件ckeditor.js 2.在使用编辑器的地方插入 ...
- C# ASP.NET MVC 配置允许跨域访问
在web.config文件中的 system.webServer 节点下 增加如下配置 <httpProtocol> <customHeaders> <add name= ...
- ASP.NET MVC配置Redis服务
===================== 1.下载并安装Redis.官网并未提供Windows安装版,所以去Github 下载 下载地址: https://github.com/MicrosoftA ...
随机推荐
- 在嵌入式开发板中运行程序提示-/bin/sh: ./xx: not found的解决办法
今天拿着我的tiny6410板子,在虚拟机上用 $arm-linux-gcc he.c -o he 编译后放到tiny6410的文件系统中提示 -/bin/sh: ./xx: not found 后来 ...
- 转:[版本控管]TortoiseSVN 使用,抓出兇手,使用 Blame 查看每一行最後修改的人是誰
类似的官方的使用手段有: https://tortoisesvn.net/docs/nightly/TortoiseSVN_zh_CN/tsvn-dug-blame.html from: http:/ ...
- vijos1334 NASA的食物计划(二维费用的背包问题)
背景 NASA(美国航空航天局)因为航天飞机的隔热瓦等其他安 全技术问题一直大伤脑筋,因此在各方压力下终止了航天 飞机的历史,但是此类事情会不会在以后发生,谁也无法 保证,在遇到这类航天问题时,解决方 ...
- APIO2013 tasksauthor
喜闻乐见的提答题,这道题还是蛮有趣的 数据结构题写得心塞,来一道提答意思意思 如果喜欢这类题的话还可以去做做uoj83. 这题是给出了两个问题,一个最短路,一个无向图染色问题. Data 1 Floy ...
- PHP命令行模式
<?php error_reporting(E_ALL); header('Content-Type:text/plain;charset=utf-8'); interface CommandA ...
- Hilbert-Huang Transform: matlab 希尔伯特-黄变换: matlab实现
关于Hilbert-Huang的matlab实现,材料汇总,比较杂...感谢所有网络上的贡献者们:) 核心:以下代码计算HHT边际谱及其对应频率 工具包要求:G-Rilling EMD Toolbox ...
- MySQL数据库的优化(上)单机MySQL数据库的优化
MySQL数据库的优化(上)单机MySQL数据库的优化 2011-03-08 08:49 抚琴煮酒 51CTO 字号:T | T 公司网站访问量越来越大,导致MySQL的压力越来越大,让我们自然想到的 ...
- Codevs 1229 数字游戏
1229 数字游戏 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 白银 Silver 题目描述 Description Lele 最近上课的时候都很无聊,所以他发明了 ...
- windows命令行下简单使用javac、java、javap详细演示
最近重新复习了一下java基础,在使用javap的过程中遇到了一些问题,这里便讲讲对于一个类文件如何编译.运行.反编译的.也让自己加深一下印象. 如题,首先我们在桌面,开始->运行->键入 ...
- 用RxJava处理嵌套请求
用RxJava处理嵌套请求 互联网应用开发中由于请求网络数据频繁,往往后面一个请求的参数是前面一个请求的结果,于是经常需要在前面一个请求的响应中去发送第二个请求,从而造成"请求嵌套" ...