문제

I have a front page and a CMS area with the following routes:

Default Front Page route

routes.MapRoute(
    name: "Default",
    url: "{controller}/{action}/{id}",
    defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
    namespaces: new string[] { "SiteFactory.Site.Controllers" }

Administration route

context.MapRoute(
        "Administration_default",
        "administration/{controller}/{action}/{id}",
        new { controller = "Home", action = "Index", id = UrlParameter.Optional }
        );

I would like to route from my ContentController (inside the administration area) to the front page HomeController, like this:

[HttpPost]
[ValidateInput(false)]
public ActionResult Save(string content, string contentId, string pageId)
{
    if (ModelState.IsValid)
    {
        //TODO: save content.
    }
    return RedirectToRoute("Default");
}

How can i do this?

도움이 되었습니까?

해결책

just return RidirectToAction("Index", "Home");

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top