Question

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.

Was it helpful?

Solution

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

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

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