且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Asp.Net Core 2中使用JwtBearer身份验证时,返回401而不是重定向到登录页面

更新时间:2023-09-20 22:08:16

我需要配置 StatusCodePages 中间件,以避免重定向.

I needed to configure the StatusCodePages middleware to avoid the redirect.

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
    ...
    app.UseStatusCodePages();
    ...
}