MVC 5 How to define Owin LoginPath with localized routes

前端 未结 8 664
有刺的猬
有刺的猬 2020-12-12 19:18

I have a MVC 5 website with localized routes defined as

routes.MapRoute(
            name: \"Default\",
            url: \"{culture}/{controller}/{action}/{         


        
8条回答
  •  无人及你
    2020-12-12 20:00

    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")
    });
    

提交回复
热议问题