zoukankan      html  css  js  c++  java
  • MVC:分页改进URL

    http://localhost/?page=2

       

    可以根据"可组合URL"创建一种更具吸引力的URL方案:

    http://localhost/page2

       

    public static void RegisterRoutes(RouteCollection routes)  

            {  

                routes.IgnoreRoute("{resource}.axd/{*pathInfo}");  

        

                routes.MapRoute(  

                name: null,  

                url: "Page{page}",  

                defaults: new { Controller = "Product", action = "List" }  

                );  

        

                routes.MapRoute(  

                    name: "Default",  

                    url: "{controller}/{action}/{id}",  

                    defaults: new { controller = "Product", action = "List", id = UrlParameter.Optional }  

                );  

            }  

       

    重要的是在已有的 Default 路由之前天津唉纸条路由。

  • 相关阅读:
    uva 532
    uva 10557
    uva 705
    uva 784
    uva 657
    uva 572
    uva 10562
    usa物价统计
    2019/6/30,道歉书
    名词收集
  • 原文地址:https://www.cnblogs.com/tangge/p/6378188.html
Copyright © 2011-2022 走看看