我在付款区域有一个名为PaymentsController的控制器。 当我要求本地主机/付款/付款/索引'但是我希望通过&localhost / payments / pa / index'或者只是本地主机/付款'
我需要两个名字。
我尝试像
这样的事情using System.Web.Mvc;
namespace Execplan.MVC.Areas.Payments
{
public class PaymentsAreaRegistration : AreaRegistration
{
public override string AreaName
{
get
{
return "Payments";
}
}
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"Payments_default",
"Payments/{controller}/{action}/{id}"
);
context.MapRoute(
"Payments_pa",
"Payments/Pa/{action}/{id}"
, new { controller = "payments", action = "Index", id = UrlParameter.Optional }
);
}
} }