Asp.Net Core Mvc项目登录IdentityServer4验证无法跳转问题

Asp.Net Core Mvc项目连接IdentityServer4项目,输入账号密码验证后,无法跳转到MVC项目。

 

 停留在 http://localhost:5001/Account/Login?ReturnUrl 这个界面,不跳转

解决方法:IdentityServer4项目中Startup类中

 public void ConfigureServices(IServiceCollection services)

这个方法中添加如下代码:

  services.AddAuthentication(options =>
            {
                options.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme;
                options.DefaultChallengeScheme = CookieAuthenticationDefaults.AuthenticationScheme;
            }).AddCookie("Cookies");

 

posted @ 2021-08-01 07:15  天众师兄  阅读(363)  评论(0编辑  收藏  举报