C# Microsoft.Identity.Web AddMicrosoftIdentityWebApp-无法设置AccessDeniedPath

C# Microsoft.Identity.Web AddMicrosoftIdentityWebApp-无法设置AccessDeniedPath,c#,asp.net-core,asp.net-identity,C#,Asp.net Core,Asp.net Identity,我正在.NET core 3.1应用程序(需要LTS)中使用包Microsoft.Identity.Web 我可以按照文档进行操作,但是我可以成功设置AccessDeniedPath,但是登录不会持续,或者没有设置路径 我在这里尝试了两种方法: 我还有通过外部方案登录的本地用户/角色 我的初创公司目前看起来像: 添加标准标识 services.AddDefaultIdentity<ApplicationUser>() .AddRoles<App

我正在.NET core 3.1应用程序(需要LTS)中使用包Microsoft.Identity.Web

我可以按照文档进行操作,但是我可以成功设置
AccessDeniedPath
,但是登录不会持续,或者没有设置路径

我在这里尝试了两种方法:

我还有通过外部方案登录的本地用户/角色

我的初创公司目前看起来像:

添加标准标识

services.AddDefaultIdentity<ApplicationUser>()
                .AddRoles<ApplicationRole>()
                .AddEntityFrameworkStores<ApplicationDbContext>();
如果我将
services.AddAuthentication()
更改为
services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
,则重定向有效,但用户登录不会持续

代码将获取用户,并从以下位置返回成功:
var result=wait\u signingmanager.externalloginginasync(info.LoginProvider,info.ProviderKey,ispersist:rememberMe)但是登录并没有让我觉得这是一个cookie问题,命名错误等等

这就是我想要做的吗?或者我应该使用
添加Microsoft
身份验证并检查域吗?由于此方法只能从公共端点(从我所能找到的端点)起作用。

此线程可以帮助您吗?
var azureAdConfig = Configuration.GetSection("AzureAD");
            services.AddAuthentication()
                .AddMicrosoftIdentityWebApp(options =>
                {
                    options.ClientId = azureAdConfig["ClientId"];
                    options.TenantId = azureAdConfig["TenantId"];
                    options.Domain = azureAdConfig["Domain"];
                    options.Instance = azureAdConfig["Instance"];
                    options.CallbackPath = azureAdConfig["CallbackPath"];
                    options.SignedOutCallbackPath = azureAdConfig["SignedOutCallbackPath"];

                    //options.AccessDeniedPath = new PathString("/Account/AccessDenied");
                }, options =>
                {
                    options.AccessDeniedPath = new PathString("/Account/AccessDenied");
                });