locked
HttpClient loses a lot of functionality of the HttpWebRequest RRS feed

  • Question

  • Is there a way I can (1. add header 2. read cookie back 3. set allow redirect 4. set cache policy 5. set Decompression 6. use credential) using HttpClient like the old HttpWebRequest? It seems that the current HttpClient is not very useful in the real world application.

    Wednesday, October 5, 2011 12:58 PM

Answers

  • HttpClient is the "front end" to the entire Http experience; the actually work is done by a series of "handlers".  The bottommost handler (almost always HttpClientHandler) does the actually HTTP and networking.  Most of what you'll need to set is on the HttpClientHandler and the HttpRequestMessage.

    Useful links:  we did a session (number PLAT-581T) at //build/ 

    Documentation for HttpClient  and HttpClientHandler and HttpRequestMessage

    And we have a sample you may find useful.


    Network Developer Experience Team (Microsoft)
    • Proposed as answer by tomtaylor-msft Thursday, October 6, 2011 1:00 AM
    • Marked as answer by pink Jedi Thursday, October 6, 2011 8:58 AM
    Wednesday, October 5, 2011 9:14 PM

All replies

  • HttpWebRequest is still in the profile.

    Also look at HttpClientHandler for some of the other properties to use with HttpClient


    Tim Heuer | Program Manager, XAML | http://timheuer.com/blog | @timheuer

    (if my post has answered your question, please consider using the 'mark as answer' feature in the forums to help others)
    • Proposed as answer by tomtaylor-msft Thursday, October 6, 2011 1:00 AM
    Wednesday, October 5, 2011 5:04 PM
  • HttpClient is the "front end" to the entire Http experience; the actually work is done by a series of "handlers".  The bottommost handler (almost always HttpClientHandler) does the actually HTTP and networking.  Most of what you'll need to set is on the HttpClientHandler and the HttpRequestMessage.

    Useful links:  we did a session (number PLAT-581T) at //build/ 

    Documentation for HttpClient  and HttpClientHandler and HttpRequestMessage

    And we have a sample you may find useful.


    Network Developer Experience Team (Microsoft)
    • Proposed as answer by tomtaylor-msft Thursday, October 6, 2011 1:00 AM
    • Marked as answer by pink Jedi Thursday, October 6, 2011 8:58 AM
    Wednesday, October 5, 2011 9:14 PM