none
关于httpclient 添加自定义cookies问题 RRS feed

全部回复


  • //Set cookie var baseAddress = new Uri(send.Host); var handler = new HttpClientHandler(); HttpClient client = new HttpClient(handler) { BaseAddress = baseAddress }; if (!string.IsNullOrEmpty(send.CookieValue)) { CookieContainer cc = new CookieContainer(); handler.CookieContainer = cc; cc.Add(baseAddress, new Cookie(send.CookieName, send.CookieValue)); }

    按需要改改

    2016年8月10日 2:27