未找到RedirectToRoute的匹配路线

时间:2012-12-29 07:55:07

标签: asp.net web-applications

<%@ Import Namespace="System.Web.Routing" %>
 void Application_Start(object sender, EventArgs e) 
    {
        RegisterRoutes(RouteTable.Routes);
    }
 public static void RegisterRoutes(RouteCollection routes)
    {
        RouteTable.Routes.Add(new System.Web.Routing.Route("{resource}.axd/{*pathInfo}", new System.Web.Routing.StopRoutingHandler()));

        RouteTable.Routes.MapPageRoute("StoreRoute", "{Name}", "~/Default.aspx");

        RouteTable.Routes.MapPageRoute("Listing", "{keyword}/{city}/{area}", "~/Listing.aspx");

    }

在上面的代码我写了两个路线首先是“StoreRout”,工作正常 第二个“清单”路线无效 现在我的网址是 http://www.sitename.com/Listing.aspx?keyword=Media&City=Pune&area=camp

我想要的网址应该像http://www.sitename.com/Media/Pune/camp 请帮帮我。

1 个答案:

答案 0 :(得分:0)

第二条路线的适当网址是:

http://www.sitename.com/Listing/Media/Pune/camp