Frage

The director below keeps redirecting to my homepage (Home/Index). I'm not sure why, but I have other areas created called Coaches and Directors, and they work fine. Fiddler only shows a 302 from that dashboard action to the homepage. If I go to /athletes/dashboard/index it works fine.

public virtual ActionResult Dashboard()
        {
            return RedirectToAction(MVC.Athletes.Dashboard.Index());
        }

Global.asax

routes.MapRoute(
               "Default",
               "{controller}/{action}",
               new { controller = "Home", action = "Index", area="" },
               new[] { "Tournaments.Controllers", "Tournaments.Controllers.Api" }
           );

Area

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" }
            );
        }
    }
}
War es hilfreich?

Lösung

Found the issue, I was calling a URL from the coaches area from an ajax request, and it was causing a redirect from the page because the user wasnt in the coach role, and because I had a URL redirect from the Rewrite Module, blah.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top