zoukankan      html  css  js  c++  java
  • 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*" });

    }
    }

  • 相关阅读:
    字幕文件srt处理之pysrt
    python 多进程代码问题以及用 pyinstaller 打包成exe 问题解决
    ffmpeg的安装以及使用
    人声识别之webrtcvad
    python3安装dlib库和face_recognition库
    python实现 请按任意键继续。。。
    python 模块tkinter之filedalog
    古诗文网验证码识别
    xpath案例-全国城市名爬取
    xpath案例-4K图片爬取
  • 原文地址:https://www.cnblogs.com/louby/p/5313869.html
Copyright © 2011-2022 走看看