且构网

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

从中间件设置 ASP.NET Core 中的 HttpResponse 的原因

更新时间:2023-02-16 11:16:02

试试这个:

context.Response.StatusCode = 401;
context.Response.HttpContext.Features.Get<IHttpResponseFeature>().ReasonPhrase = "Missing or invalid token.";