How to localize LoginPath in ASP.NET Core MVC 3.1

245 Views Asked by At

I use CookieAuthentication in ASP.NET Core MVC 3.1 and I have to set the LoginPath while configuring in the Startup.cs.

I have this so far:

public void ConfigureServices(IServiceCollection services)
{
    services.AddAuthentication("CookieAuthentication")
            .AddCookie("CookieAuthentication", config =>
            {
                config.Cookie.Name = "UserLoginCookie";
                config.LoginPath = "/connexion"; 
                config.SlidingExpiration = true;
                config.ExpireTimeSpan = TimeSpan.FromHours(2);
            });

    ...
}

But I would like now to be able to localize the LoginPath but I can't figure out how.

My goal is to call different Url according to the current culture. For example /connexion if the culture is French and /connect if it's English.

Any ideas how to achieve this??

Thank you!

0

There are 0 best solutions below