0
<%@ 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”,它工作正常,第二条“Listing”路线现在不起作用,我的网址是 http://www.sitename.com/Listing.aspx?keyword=Media&City =浦那&地区=营地

我想 url 应该像 http://www.sitename.com/Media/Pune/camp 请帮助我。

4

1 回答 1

0

第二条路线的适当 URL 是:

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

于 2012-12-29T08:15:19.590 回答