MVC Html.BeginForm - Move /en/ to start of the url

414 Views Asked by At

I'm trying to create a form in episerver, it's just an ASP.NET MVC site. The piece of code I'm using is this

@using (Html.BeginForm("Index", "Search", new { language = ContentLanguage.PreferredCulture.Name }, FormMethod.Get))
{
   ...
}

When the page is rendered, I get:

<form action="/site-search/Index?language=en" method="get">...</form>

however, I need the "en" language component to be put at the start of the URL like so:

"/en/site-search/Index"

The reason it is needed there is because the site uses multiple languages and this is how it checks to see which version of the page to serve.

Anyone have any ideas on how to move the "/en/" component to the front of the url using the Html.BeginForm() method?

0

There are 0 best solutions below