Added SendRequestURLEncoded

This commit is contained in:
Jaex 2014-12-25 19:48:45 +02:00
parent ba9d03d6d8
commit b6e9543f42

View file

@ -231,6 +231,20 @@ protected string SendRequestJSON(string url, string json, NameValueCollection he
}
}
protected string SendRequestURLEncoded(string url, Dictionary<string, string> arguments, NameValueCollection headers = null, CookieCollection cookies = null,
HttpMethod method = HttpMethod.POST)
{
string query = CreateQuery(arguments);
byte[] data = Encoding.UTF8.GetBytes(query);
using (MemoryStream stream = new MemoryStream())
{
stream.Write(data, 0, data.Length);
return SendRequestStream(url, stream, "application/x-www-form-urlencoded", headers, cookies, method);
}
}
protected string SendRequestStream(string url, Stream stream, string contentType, NameValueCollection headers = null,
CookieCollection cookies = null, HttpMethod method = HttpMethod.POST)
{