MVC add token in http header

牧云@^-^@ 提交于 2019-12-12 19:40:50

问题


I have a .NET MVC application which is calling a WCF service. I need to include a JWT token in the HTTP header of the MVC application and decode the token in the WCF application. The binding is basicHttpBinding. I would appreciate any suggestions...


回答1:


assuming you are inside controller method write :

ControllerContext.HttpContext.Response.AddHeader("name","value")



回答2:


I finally managed to find a solution and I've sent the token through a SOAP header.

For that I just had to add

<headers>
<headerName>Value</headerName>
</headers>


来源:https://stackoverflow.com/questions/18780457/mvc-add-token-in-http-header

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