0

次のルートを持つフロント ページと CMS エリアがあります。

デフォルトのフロント ページ ルート

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

投与経路

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

次のように、ContentController (管理領域内) からフロント ページの HomeController にルーティングしたいと思います。

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

これどうやってするの?

4

1 に答える 1