0

I need this sort of redirect to happen in my application:

/car go to show-all-cars.aspx

/car/1234 go to edit-car.aspx

This is my current code in global.asax:

routeCollection.MapPageRoute("car-edit",
                "car/{id}",
                "~/car-edit.aspx",
                true,
                new RouteValueDictionary { { "id" } });

routeCollection.MapPageRoute("car-all",
                "car",
                "~/show-all-cars.aspx",
                true);

For some reason, going to /car results in a redirect to car-edit.aspx instead of show-all-cars.aspx as needed.

Any ideas?

Webforms C#.NET 4.0

4

1 回答 1

0

只需交换两条路线,即将第二条路线放在第一条之前。

于 2012-08-10T19:07:43.367 回答