I am attempting to redirect to a different login url in ASP.NET MVC6
My account controller login method has a Route
attribute to change the url.
If you check UseIdentity
extension method here you will notice that it is using IdentityOptions
not CookieAuthenticationOptions
, so instead you must configure IdentityOptions
:
services.Configure<IdentityOptions>(opt =>
{
opt.Cookies.ApplicationCookie.LoginPath = new PathString("/login");
});
Edit
For asp.net core 2.0: Identity cookie options are no longer part of IdentityOptions. Check mxmissile's answer.