1

下面的导演一直重定向到我的主页(主页/索引)。我不知道为什么,但我创建了其他区域,称为教练和主管,它们运行良好。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" }
            );
        }
    }
}
4

1 回答 1

0

发现了问题,我从 ajax 请求中调用了 coaches 区域的 URL,它导致了页面的重定向,因为用户不是教练角色,并且因为我有来自 Rewrite Module 的 URL 重定向,等等。

于 2013-09-20T04:33:28.667 回答