asp core redirect based on login code example
Example: .net core login redirect loop
// Startup.cs
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
// authentication has to come before authorization, or you get an infinite redirect!
app.UseAuthentication()
app.UseAuthorization()
}