我想点某一个链接可以直接通过比如 http://www.mysite.com/shanghai,http://www.mysite.com/beijing之类的来访问,但是现在貌似只能是这样的格式才能访问http://www.mysite.com/Home/index/shanghai,route应该怎么改?  routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional },
                new string[] { "tougou.Controllers" });

解决方案 »

  1.   

    routes.MapRoute(
      "Default", // Route name
      "{id}", // URL with parameters
      new { controller = "Home", action = "Index", id = UrlParameter.Optional },
      new string[] { "tougou.Controllers" });
      

  2.   

    这不行吧,http://www.mysite.com/ 都死掉了
      

  3.   

    不是有 Map 序列化程序 吗
      

  4.   

    给id个默认值
    routes.MapRoute(
      "Default", // Route name
      "{id}", // URL with parameters
      new { controller = "Home", action = "Index", id = "beijing" },
      new string[] { "tougou.Controllers" });
      

  5.   

    这里有调试工具介绍http://haacked.com/archive/2011/04/13/routedebugger-2.aspx