I am using ASP.Net core MVC 6, I am trying to get the user redirected to the login page if they are not authenticated.
I cant seem to get it to work, currently the u
OK, as of Asp.Net Core 2.1 . In order to redirect user to login page. this is what you need to do in ConfigureServices(IserviceCollection services) method.
services.ConfigureApplicationCookie(options =>
{
options.LoginPath = "/Identity/Account/Login";
options.SlidingExpiration = true;
});
for more info visit Microsoft identity documentation. https://docs.microsoft.com/en-us/aspnet/core/security/authentication/identity-configuration?view=aspnetcore-2.1#cookie-settings