Raportare
2つのアクションを持つという名前のコントローラーがあります:ReportA
とReportB
。どちらも、指定されたパラメータに基づいてExcelファイルを返します。
public ActionResult ReportA(int? month, int? year)
{
...
}
public ActionResult ReportB(int? month, int? year)
{
...
}
私の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 });
ただし、mysite.com / Raportare / ReportB / 5/2012にアクセスすると、ReportAファイルが返されます。mysite.com/Raportare/ReportB?month=5&year=2012にアクセスすると、正常に機能します。おそらくルーティングルールで何か間違ったことをしているのですが、それを理解することはできません。