LoginPath not working in ASP.NET Core

  • 749 Views
  • Last Post yesterday
lucy posted this 4 weeks ago

This post shows you how to solve 'LoginPath not working in ASP.NET Core'.

By default, if you don't configure it's automatically redirect to "/Account/Login?RedirectUrl=%2F"

Opening your Startup class, then add a configuration as shown below.

services.ConfigureApplicationCookie(options =>
            {
                options.LoginPath = new PathString("/Identity/Account/Login");
                options.ReturnUrlParameter = "RedirectUrl";
                options.LogoutPath = new PathString("/Identity/Account/Lockout");
                options.AccessDeniedPath = new PathString("/Identity/Account/AccessDenied");
                options.ExpireTimeSpan = TimeSpan.FromDays(1);
            });

instead of use services.AddAuthentication().AddCookie

services.AddAuthentication().AddCookie(options =>
            {
    options.LoginPath = "/Identity/Account/Login";
    options.ExpireTimeSpan = TimeSpan.FromDays(1);
});
Frargearo posted this yesterday

Jnj Priligy [url=https://abuycialisb.com/]generic cialis tadalafil[/url] Sale Isotretinoin Low Price Cialis Levitra Generico Sicuro

Close