下面的导演一直重定向到我的主页(主页/索引)。我不知道为什么,但我创建了其他区域,称为教练和主管,它们运行良好。Fiddler 仅显示从该仪表板操作到主页的 302。如果我去/athletes/dashboard/index
它工作正常。
public virtual ActionResult Dashboard()
{
return RedirectToAction(MVC.Athletes.Dashboard.Index());
}
全球.asax
routes.MapRoute(
"Default",
"{controller}/{action}",
new { controller = "Home", action = "Index", area="" },
new[] { "Tournaments.Controllers", "Tournaments.Controllers.Api" }
);
区域
namespace Tournaments.Areas.Athletes
{
public class AthletesAreaRegistration : AreaRegistration
{
public override string AreaName
{
get
{
return "Athletes";
}
}
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"Athletes",
"athletes",
new { action = "Index", controller = "Dashboard", bodyclass = "members" },
new[] { "Tournaments.Areas.Athletes.Controllers" }
);
context.MapRoute(
"Athletes_Dashboard",
"athletes/dashboard/{action}",
new { action = "Index", controller = "Dashboard" },
new[] { "Tournaments.Areas.Athletes.Controllers" }
);
context.MapRoute(
"Athletess_Default",
"athletes/{controller}/{action}",
new { action = "Index", controller = "Dashboard" },
new[] { "Tournaments.Areas.Athletes.Controllers" }
);
}
}
}