.HttpContext.Features.Get<IHttpResponseFeature>().ReasonPhrase is not working in .net core 2.1?

巧了我就是萌 提交于 2019-12-14 01:33:36

问题


We are using the code below to send the custom message from server side to client side in HTTP request. It is working properly in .NET Core 2.0

Response.HttpContext.Features.Get<IHttpResponseFeature>().ReasonPhrase

While using the same code in .NET Core 2.1 it does not work. It doesn't throw any script errors but we couldn't get message in client side success.

How to resolve this problem?


回答1:


I hope it answers your question:

This is not caused by any code changes in the framework, it's caused by a project configuration change.

The 2.0 project templates did not have HTTPS enabled by default, the 2.1 templates do. When using HTTP the browser uses HTTP/1.1 and ReasonPhrase works as expected. When using HTTPS the browser uses HTTP/2 and ReasonPhrase no longer works.

Full answer by Chris Ross here.



来源:https://stackoverflow.com/questions/54285164/httpcontext-features-getihttpresponsefeature-reasonphrase-is-not-working-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!