HttpClient not passing cookie values RRS feed

  • Question

  • Hi,

    using the HttpClient i am calling the api, i am sending the cookie using the WebRequestHandler.cookiecontainer, it is sending properly and getting the response. but when i am hitting the https secured apis it is not sending the cookie value. 


      WebRequestHandler certificateHandler = new WebRequestHandler();
                certificateHandler.CookieContainer = cookiesContainer;
                certificateHandler.UseCookies = true;
                certificateHandler.ClientCertificateOptions = ClientCertificateOption.Manual;
                X509Certificate certificate = GetMyX509Certificate();
                using (HttpClient httpClientObj = new HttpClient(certificateHandler))



    this is working fine for http api, but it is not sending the cookie when i am hitting a secure api(https).

    i am not sure what is the exact problem, 

    your help will be highly appreciated.

    Advance Thanks,


    Wednesday, February 17, 2016 4:26 PM


  • Hi VijayAluvala,

    >>this is working fine for http api, but it is not sending the cookie when i am hitting a secure api(https).

    You could first refer to this thread to check whether the cookies are added properly.


    Then, as the following similar thread says CookieContainer won't send secure cookies back to the server in subsequent HTTP requests. A workaround is to re-add the cookie to CookieContainer manually. So, if your issue is the same with this, you could try the workaround to solve the problem.

    Besides, you could use the Fiddler to monitor the request to check whether the cookies are sent to the https URL.


    Best Regards,

    Albert Zhang

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Proposed as answer by Albert_Zhang Wednesday, March 2, 2016 5:28 AM
    • Marked as answer by Kristin Xie Friday, March 4, 2016 2:07 AM
    Thursday, February 18, 2016 6:54 AM