I have a MVC 5 website with localized routes defined as
routes.MapRoute(
name: \"Default\",
url: \"{culture}/{controller}/{action}/{
Without taking too much of responsibility on the url format etc, you can do something like the following
public static void Configuration(IAppBuilder app)
{
UrlHelper url = new UrlHelper(HttpContext.Current.Request.RequestContext);
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString(url.Action("LogOn", "Account", new { area = "Account" })),
Provider = new CookieAuthenticationProvider
{
OnApplyRedirect = context => context.Response.Redirect(context.RedirectUri.Replace(CultureHelper.GetDefaultCulture(), Thread.CurrentUiCulture.Name))
}
});
}
The solution can be even simpler if you put the culture on the loginpath :
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
//Your other properties here
LoginPath = new PathString("/{culture}/User/Login")
});