0

I have page with culture chooser control. This control is rendered as a partial on the Layout page.

@Html.Partial("~/Views/Shared/CultureChooserUserControl.cshtml")

The culture chooser control looks like this:

@Html.ActionLink("English", "ChangeCulture", "Default",  new { lang = "en", returnUrl =     this.Request.RawUrl }, new { @class = "englishFlagButton" })
@Html.ActionLink("Deutsch", "ChangeCulture", "Default",  new { lang = "de", returnUrl = this.Request.RawUrl }, new { @class = "germanFlagButton" })
@Html.ActionLink("French", "ChangeCulture", "Default",  new { lang = "fr", returnUrl = this.Request.RawUrl }, new { @class = "frenchFlagButton" })
@Html.ActionLink("Italian", "ChangeCulture", "Default",  new { lang = "it", returnUrl = this.Request.RawUrl }, new { @class = "italianFlagButton" })

The culture change method is in the default controller of the page, which gives the following when I want to change the culture:

http://localhost/myapp/Default/ChangeCulture......

Now i seperated my site with areas, the problem is that when I try to change the culture when I am in an area the request is wrong and that leads to an error:

http://localhost/myapp/**AREA/Default**/ChangeCulture.....

How can I fix this. Thanks for your support in advance.

Frank.

1

1 Answer 1

2

When your layout use all areas and culture change action is in controller in default area then set in layout in your routeValues object area = "" in all helpers that address to this action, for example:

@Html.ActionLink("English", "ChangeCulture", "Default",  new { lang = "en", returnUrl = this.Request.RawUrl, @area = "" }, new { @class = "englishFlagButton" })
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.