Question

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?

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top