I have a controller with a name Raportarethat has two actions: ReportAand ReportB. Both return an excel file based on the provided parameters.
public ActionResult ReportA(int? month, int? year)
{
...
}
public ActionResult ReportB(int? month, int? year)
{
...
}
My global.asax has the following routing rules for this:
routes.MapRoute(
"ReportA",
"{Raportare}/{ReportA}/{month}/{year}",
new { controller = "Raportare", action = "ReportA", month = UrlParameter.Optional, year = UrlParameter.Optional});
routes.MapRoute(
"ReportB",
"{Raportare}/{ReportB}/{month}/{year}",
new { controller = "Raportare", action = "ReportB", month = UrlParameter.Optional, year = UrlParameter.Optional });
However, when I go to mysite.com/Raportare/ReportB/5/2012, it returns a ReportA file. It works great if I go to mysite.com/Raportare/ReportB?month=5&year=2012. I'm probably doing something wrong in the routing rules, but I can't figure it out.
source
share