在MVC中配置鉴权
builder.Services.AddAuthentication(option => { option.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme; }).AddCookie(CookieAuthenticationDefaults.AuthenticationScheme, option => { option.LoginPath = "/Login/Index";//没登录跳到登录页 option.AccessDeniedPath = "/Login/NoAuthority"; //登录了没权限 });