How configure multiple login pages in ASP.NET Core Razor Pages?

In ConfigureServices method add below code:

public void ConfigureServices(IServiceCollection services)
   services.AddRazorPages().AddRazorPagesOptions(options =>
   // authenticated user only
   options.Conventions.AuthorizeAreaFolder("Staff", "/Manage");

   // user with certain roles only
   options.Conventions.AuthorizeAreaFolder("Admin", "/");

Create initial login page for determining which login page to redirect to based on the return url

© 2022 .Net FAQs' - WordPress Theme by WPEnjoy