private string WebRequestAuthorization(string url)
{
string jsonResponse = string.Empty;
try
{
var webRequest = System.Net.WebRequest.Create(url);
if (webRequest != null)
{
webRequest.Proxy = new WebProxy(this.WebProxyUrl, true);
webRequest.Proxy.Credentials = CredentialCache.DefaultCredentials;
webRequest.Method = "GET";
webRequest.Headers.Add("Authorization", "");
using (System.IO.Stream s = webRequest.GetResponse().GetResponseStream())
{
using (System.IO.StreamReader sr = new System.IO.StreamReader(s))
{
jsonResponse = sr.ReadToEnd();
}
}
}
}
catch (Exception ex)
{
Logger.Error("Error while getting json response using web request", ex);
throw ex;
}
return jsonResponse;
}
{
string jsonResponse = string.Empty;
try
{
var webRequest = System.Net.WebRequest.Create(url);
if (webRequest != null)
{
webRequest.Proxy = new WebProxy(this.WebProxyUrl, true);
webRequest.Proxy.Credentials = CredentialCache.DefaultCredentials;
webRequest.Method = "GET";
webRequest.Headers.Add("Authorization", "");
using (System.IO.Stream s = webRequest.GetResponse().GetResponseStream())
{
using (System.IO.StreamReader sr = new System.IO.StreamReader(s))
{
jsonResponse = sr.ReadToEnd();
}
}
}
}
catch (Exception ex)
{
Logger.Error("Error while getting json response using web request", ex);
throw ex;
}
return jsonResponse;
}