I have a controller named Raportare
that has two actions: ReportA
and ReportB
.
Both return an excel file based on the parameters supplied.
public ActionResult ReportA(int? month, int? year)
{
...
}
public ActionResult ReportB(int? month, int? year)
{
...
}
My global.asax对此有如下路线规则:
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 mysite.com/Raportare/ReportB/5/2012 it s returning the ReportA file. It works fine if I go to mysite.com/Raportare/ReportB?month=5&year=2012. Probably I m doing something wrong in the routing rules but I can t figure it out.