I have several url patterns as follows in the Route:
{lang}/package/{packageID}
{lang}/package/{packageID}/Edit/{partNumber}
...
There's a footer in layout.cshtml, the footer provides different culture links for users to change the language of the website. When the user click the link, I hope it can change the language and stay in the current page, so I render the link by Razor like this:
@Html.ActionLink("English", ViewContext.RouteData.Values["Action"], ViewContext.RouteData.Values["Controller"], new { lang = "en-us"}, null)
@Html.ActionLink("Traditional Chinese", ViewContext.RouteData.Values["Action"], ViewContext.RouteData.Values["Controller"], new { lang = "zh-tw"}, null)
@Html.ActionLink("Japanese", ViewContext.RouteData.Values["Action"], ViewContext.RouteData.Values["Controller"], new { lang = "ja-jp"}, null)
...
But there is a problem is that I need to pass other parameters which I mentioned above to the page accordingly to keep users staying in the current page.
How could I achieve in this scenario?
Thanks!
{lang}segment the last in the route, what you want would happen automatically.