views:

182

answers:

1

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.

+1  A: 

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.

Zhaph - Ben Duguid
The only other route above this one is routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); I'll check out the route debugger. Thanks.
rotary_engine