private static string CreateUrl(string path, NameValueCollection query)
{
string url = path;
if (query != null && query.Count != 0)
{
url += "?";
for (int i = 0; i < query.Count; i++)
{
string key = query.GetKey(i);
string[] values = query.GetValues(key);
for (int j = 0; j < values.Length; j++)
{
url += key + "=" + values[j] + "&";
}
}
url = url.TrimEnd('&');
}
return url;
}