How to get an specific header value from the HttpResponseMessage

前端 未结 7 1831
挽巷
挽巷 2020-12-16 09:17

I\'m making an HTTP call. My response contains a session code X-BB-SESSION in the header section of the HttpResponseMessage object. How do I get th

7条回答
  •  无人及你
    2020-12-16 09:29

    You can do this more easily now with

    var session = response.GetHeaderValue("X-BB-SESSION");
    

    Method returns null if the header does not exist.

提交回复
热议问题