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());
            }
  • 相关阅读:
    材料订单不在IN_MO或者IN_SCFHEADER中
    FP ABPPMGR表 其它常用存储过程
    ORA-01578 ORACLE data block corrupted (file # 29, block # 2889087)
    PR合并回写
    MySQL优化
    分享一些JVM常见的面试题(转)
    怎么保证 redis 和 db 中的数据一致
    User space(用户空间) 与 Kernel space(内核空间)
    如何设计一个安全的对外接口?(转)
    Jstack命令详解
  • 原文地址:https://www.cnblogs.com/fanying/p/10918800.html
Copyright © 2011-2022 走看看