rotary_engine
rotary_engine

Reputation: 569

ASp.NET MVC 1.0 map route to subdirectory

How to I setup a route of the url /customer/export/billing to the controller Customer.ExportBilling() ?

When I try this:

        routes.MapRoute(
            "exportCustomerBilling", "customer/export/billing", new { controller = "Customer", action = "ExportBilling" });

I get a 404, the controller method is not invoked.

Using <%= Html.RouteLink("Export customers for billing", "exportCustomerBilling", null) %> returns the correct link, clicking on it returns a 404.

Upvotes: 1

Views: 612

Answers (1)

Zhaph - Ben Duguid
Zhaph - Ben Duguid

Reputation: 26956

You've probably got a more general route registered above the Export Billing route.

Drop one of the Routing Debuggers into your site, and register it in the Global.asax, that will tell you:

  1. What order the routes are in.
  2. Which route is being matched to your request.

You can usually work out what tweaking you need to perform from there.

Upvotes: 1

Related Questions