比如http://localhost:1578/chinese/about.html?a=xxxxx
路由怎么设置才能上面的地址显示为http://localhost:1578/chinese/about/a/xxxxx.html
可以这样吗?
谢谢了.

解决方案 »

  1.   

    好像你的这个提问有点问题啊, .html是怎么冒出来的。如果没有.html设置路由很好说。
      

  2.   

                routes.MapRoute(
                    "parameter1",                                              // Route name
                    "{controller}/{action}.html",                           // URL with parameters
                    new { controller = "/Home", action = "Index", id = "" }  // Parameter defaults
                );
                
                routes.MapRoute(
                    "parameter0",                                              // Route name
                    "{controller}/{action}/{id}.html",                           // URL with parameters
                    new { controller = "/Home", action = "Index", id = "" }  // Parameter defaults
                );
                这样就好了.
    还是谢谢你们.
      

  3.   

    http://localhost:1578/chinese/about/a/xxxxx.html这儿还需要a么?a是变量名,用路由后,已经由位置决定变量名称了