Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP Identity in MVC6 - Login Path property not working

After updating from beta 5 to beta 8 I can't set my custom login path in cookie authentication options.

services.AddCookieAuthentication(config =>
{
    config.LoginPath = "/Auth/Login";
    //or
    //config.LoginPath = new Microsoft.AspNet.Http.PathString("Auth/Login");
});

This value is completely ignored. Still gets redirected to the default '/Account/Login'. Is there any other options to set this path?

like image 478
Pawel Maga Avatar asked Oct 20 '15 21:10

Pawel Maga


1 Answers

It seems that now you should do this a bit differently (worked for me):

services.Configure<IdentityOptions>(options=>
{
    options.Cookies.ApplicationCookie.LoginPath = new Microsoft.AspNet.Http.PathString("/Auth/Login");
});

From here.

like image 88
Olga Zemskova Avatar answered Oct 22 '22 06:10

Olga Zemskova