문제

I have a next routes settings:

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 }
                    );

When user is open TestCC action I try to redirect them to other action that should conteine {culture}

public ActionResult TestAction()
        {
            TempData["pp"] = Request["p1"];
            TempData["dd"] = Request["p2"] ;
            return RedirectToAction("OtherAction", "OtherController");
        }

How to add {culture} part to redirect in RedirectToAction? I don't want to write culture="value" to Default route.

도움이 되었습니까?

해결책

Not sure if I understand you correctly, but I guess this will do what you want:

RedirectToAction("OtherAction", "OtherController", new {culture = "value"});

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