我有一个首页和一个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");
}
我该怎么做?
答案 0 :(得分:1)
只是return RidirectToAction("Index", "Home");