ASP.NET MVC5 实现网址伪静态

ASP.NET MVC5 实现网址伪静态
一、路由规则:
routes.MapRoute(
                name: "Default1",
                url: "more_{root}_{plate}.html",
                defaults: new { controller = "about", action = "Index", root = UrlParameter.Optional, plate = UrlParameter.Optional }
            );

二、定义URL:
<a href="@Url.Action("index", "about", new { root = 1, plate = 2 })">123456</a>

三、在VIew获取参数:
<p>root: @(Url.RequestContext.RouteData.Values["root"])</p>
<p>plate: @(Url.RequestContext.RouteData.Values["plate"]) </p>
ASP.NET MVC5 实现网址伪静态

还需要在webconfig配置:

ASP.NET MVC5 实现网址伪静态

ASP.NET MVC5 实现网址伪静态,布布扣,bubuko.com

ASP.NET MVC5 实现网址伪静态

上一篇:安装PLSQLDeveloper


下一篇:PHP与JDBC的达梦数据库接口配置