此问题全网找了很久,也困扰了我很久,始终没有找到解决方法。今天结合网上其他问题的帖子,自己研究的半天,终于找到了这个解决方法,经亲自测试可行。欢迎大牛指导指正。

有时客户收藏的系统地址是认证端的,然后登录之后会转向https://***:101/signin-oidc  报以下错误

An unhandled exception occurred while processing the request.

Exception: Correlation failed.

Unknown location

Exception: An error was encountered while handling the remote login.

Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler<TOptions>.HandleRequestAsync()

解决的原理就是,当远程认证错误时,转向最开始的系统首页。

解决方法

 1 services.AddAuthentication(options =>
2 {
3 options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
4 options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
5 })
6 .AddCookie(CookieAuthenticationDefaults.AuthenticationScheme)
7 .AddOpenIdConnect(OpenIdConnectDefaults.AuthenticationScheme, options =>
8 {
9 options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
10                ………………省略内容………………
11               //------------------此处开始为处理此问题-------------------
12               options.Events=new OpenIdConnectEvents()
13 { //修复登录成功之后转向signin-oidc并报错的问题
14 OnRemoteFailure = ctx =>
15 {
16 ctx.Response.Redirect($"{ctx.Request.Scheme}://{ctx.Request.Host}");
17 ctx.Response.Body.WriteAsync(null);
18 return Task.CompletedTask;
19 }
20 };
21               //---------------------处理此问题结束--------------------------------------
22 });

 

最新文章

  1. Python全栈开发day9
  2. View (二) 自定义属性 自定义属性的格式详解
  3. (1) css的核心基础
  4. ARM处理器全解析:A8/A9/A15都是什么?
  5. [lua]协同式多任务,统筹运用
  6. javascript写的ajax请求
  7. 类型转换操作符static_cast、const_cast、dynamic_cast、reinterpret_cast
  8. 理解JavaScript 的原型属性
  9. ECLIPSE中反编译插件JAD的配置安装,轻松查看JAVA源代码
  10. Angularjs通过$http与服务器通信
  11. ubuntu 解压 windows 生成的 zip 文件乱码问题
  12. 关于操作HDFS的一个问题
  13. npm由来和作用
  14. dbForge Studio for MySQL 中文乱码问题
  15. [转]Docker基础-使用Dockerfile创建镜像
  16. Create a toolwindow for the VBA editor with .NET(C#).
  17. [ZJOI2015]地震后的幻想乡(期望+dp)
  18. Beta阶段冲刺集合贴
  19. vue 绑定属性 绑定Class 绑定style
  20. 一分钟理清Vue-cli 代码构建步骤。

热门文章

  1. JZ008和大于等于target的最短数组
  2. p2p-tunnel 打洞内网穿透系列(三)TCP转发访问内网web服务
  3. 查重工具Jplag的使用
  4. 溢出属性,定位,z-index,JS
  5. docker 1.1 介绍和安装
  6. 2. springboot加载配置参数顺序
  7. 146_ACCESS之HR招聘信息管理_64位
  8. C# 蓄水池抽样
  9. java对象与Json字符串之间的转化
  10. C#获取PLC信息 (KepServer)