更新时间:2023-02-16 11:16:02
试试这个:
context.Response.StatusCode = 401; context.Response.HttpContext.Features.Get<IHttpResponseFeature>().ReasonPhrase = "Missing or invalid token.";
从中间件设置 ASP.NET Core 中的 HttpResponse 的原因
从中间件设置 ASP.NET Core 中 HttpResponse 的原因
ASP.NET Core 2.0中间件-访问配置设置
如何在Asp.Net Core 2.0的"AddJwtBearer"中设置多个受众中间件?
如何在 Asp.Net Core 2.0“AddJwtBearer"中设置多个受众中间件?
从ASP.NET Core 2.0中的中间件获取HttpContext内部的请求正文
将缓存配置文件设置移动到ASP.NET Core中的appsettings.json
访问Asp.Net Core App中的Web.config设置?
在ASP.NET Core中的中间件中注入服务