RedirectToAction Causes “No route in the route table matches the supplied values” in ASP.NET MVC 3

后端 未结 6 1280
春和景丽
春和景丽 2021-02-19 08:41

I have a project that I recently upgraded to ASP.NET MVC 3. On my local machine, everything works fine. When I deploy to the server, I get an error anytime I use a Redirec

6条回答
  •  时光取名叫无心
    2021-02-19 09:20

    I ran into this with areas within MVC3 when redirecting across areas. As others have said, Glimpse is very useful here.

    The solution for me was to pass in the Area within the route values parameter changing:

    return RedirectToAction("ActionName", "ControllerName");
    

    to:

    return RedirectToAction("ActionName", "ControllerName", new { area = "AreaName" });
    

提交回复
热议问题