Arbejdsglæde
Arbejdsglæde

Reputation: 14088

No route in the route table matches the supplied values after RedirectToAction

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.

Upvotes: 0

Views: 9933

Answers (1)

pabdulin
pabdulin

Reputation: 35229

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

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

Upvotes: 1

Related Questions