摘要: 一、配置及登录权授 1、Program.cs配置 //配置鉴权 builder.Services.AddAuthentication(option => { option.DefaultAuthenticateScheme = CookieAuthenticationDefaults.Authent 阅读全文
posted @ 2022-05-08 21:05 ziff123 阅读(130) 评论(0) 推荐(0)
摘要: IExceptionFilter有些异常捕捉不到,可以利用中间件进行补充 1、在Program.cs添加以下代码 #region 中间件处理异常 { app.UseStatusCodePagesWithReExecute("/Home/Error/{0}"); //只要不是200,都能进来 //拼装 阅读全文
posted @ 2022-05-08 19:26 ziff123 阅读(79) 评论(0) 推荐(0)
摘要: IExceptionFilter在它的作用范围内,当程序发生异常,可以接收到异常,对异常进行统一的处理。 当程序同时继承了IExceptionFilter,IAsyncExceptionFilter,则优先处理异步方法OnExceptionAsync 1、新建过滤器类CustomExceptionF 阅读全文
posted @ 2022-05-08 18:52 ziff123 阅读(334) 评论(0) 推荐(0)