我有下一个路线设置:
routes.MapRoute(
name: "TestCC",
url: "TestCC/{action}",
defaults: new { controller = "PaymentHub", action = "Cancelled" }
);
routes.MapRoute(
name: "Default",
url: "{culture}/{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
当用户打开TestCC操作时,我会尝试将它们重定向到应该跟踪{culture}的其他操作
public ActionResult TestAction()
{
TempData["pp"] = Request["p1"];
TempData["dd"] = Request["p2"] ;
return RedirectToAction("OtherAction", "OtherController");
}
如何在RedirectToAction中添加{culture}部分以重定向? 我不想将culture =“value”写入默认路由。
答案 0 :(得分:1)
不确定我是否理解正确,但我想这会做你想要的:
RedirectToAction("OtherAction", "OtherController", new {culture = "value"});