zoukankan      html  css  js  c++  java
  • MVC伪静态路由简单搭配

      public static void RegisterRoutes(RouteCollection routes)
            {
                routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
                routes.MapRoute(
                    "Root",
                    "",
                    new {controller = "Home", action = "Index", id = UrlParameter.Optional},
                    namespaces: new string[] { "Jxrlzy.Controllers" }
                    ); //根目录匹配
                
                routes.MapRoute(
                    "Controller1Html", // action伪静态    
                    "{controller}.html", // 带有参数的 URL    
                    new { controller = "Home", action = "Index", id = UrlParameter.Optional }, // 参数默认值
                    namespaces: new string[] { "Jxrlzy.Controllers" }
                    );
                routes.MapRoute(
                    "Action1Html", // action伪静态    
                    "{controller}/{action}.html", // 带有参数的 URL    
                    new {controller = "Home", action = "Index", id = UrlParameter.Optional}, // 参数默认值
                    namespaces: new string[] {"Jxrlzy.Controllers"}
                    );
                routes.MapRoute(
                    "Action", // action伪静态    
                    "{controller}/{action}", // 带有参数的 URL    
                    new { controller = "Home", action = "Index", id = UrlParameter.Optional }, // 参数默认值
                    namespaces: new string[] { "Jxrlzy.Controllers" }
                    );
                routes.MapRoute(
                    name: "Default",
                    url: "{controller}/{action}/{id}.html",
                    defaults: new {controller = "Home", action = "Index", id = UrlParameter.Optional},
                    namespaces: new string[] {"Jxrlzy.Controllers"}
                    );
                ModelBinders.Binders.Add(typeof(JObject), new JObjectModelBinder());
            }
  • 相关阅读:
    Flash 教程
    版面在简洁模式下去今日贴.主题贴.发贴总数的方法 Dvbbs
    Get Certificate of website by Firefox
    OpenSSL 命令说明
    Python 字符串操作(string替换、删除、截取、复制、连接、比较、查找、包含、大小写转换、分割等)
    Python 字符串操作(截取/替换/查找/分割)
    男子英文名释义
    AD 端口相关
    How do I obtain a Digital Certificate from my Certificate Authority (CA)?
    C,C++,java,python对比
  • 原文地址:https://www.cnblogs.com/fanying/p/10918800.html
Copyright © 2011-2022 走看看