- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
var handler = new HttpClientHandler
{
Proxy = usingProxy ? new WebProxy(proxyURI) : null,
UseProxy = usingProxy,
UseCookies = true,
CookieContainer = new CookieContainer()
};
if (session != null)
{
handler.CookieContainer.Add(new Uri(URL), new Cookie("PHPSESSID", session));
}
using (var client = new HttpClient(handler))
{
var content = new FormUrlEncodedContent(postParams);
var responseTask = client.PostAsync(url, content);
responseTask.Wait();
var responseStringTask = responseTask.Result.Content.ReadAsStringAsync();
responseStringTask.Wait();
var cookies = handler.CookieContainer.GetCookies(new Uri(URL));
session = cookies["PHPSESSID"].Value;
return responseStringTask.Result;
}
guest 19.08.2016 14:15 # −53
Segfault 19.08.2016 15:30 # −1
var responseStringTask = Task.FromResult(responseTask.Result.Cont ent.ReadAsStringAsync().ConfigureAwait(t rue)).Result;
Ну а хуля, надо пользоваться, если есть возможность.
bagor 19.08.2016 15:47 # −61