public static async Task<object> SendGetRequestBasedOnHttpClient(string requestUrl, IDictionary<string, string> routeParameters)
{
object returnValue = new object();
HttpClient client = new HttpClient();
client.MaxResponseContentBufferSize = 256000;
//format the url paramters
string paramters = string.Join("&", routeParameters.Select(p => p.Key + "=" + p.Value));
Uri uri = new Uri(string.Format("{0}?{1}", requestUrl, paramters));
try
{
var response = await client.GetAsync(uri);
if (response.IsSuccessStatusCode)
{
var stringValue = await response.Content.ReadAsStringAsync();
returnValue = JsonObject.Parse(stringValue);
}
}
catch (Exception ex)
{
throw ex;
}
return returnValue;
}