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.

tereško
  • 58,060
  • 25
  • 98
  • 150
Frank
  • 55
  • 1
  • 5
  • You may try to replace your ActionLinks with RouteLinks, see http://msdn.microsoft.com/en-us/library/system.web.mvc.html.linkextensions.routelink%28v=vs.108%29.aspx – jbl Sep 25 '13 at 14:53

1 Answers1

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" })
alxndr
  • 106
  • 3