I just tested and the string is not empy
If you replace the MessageBox by :
Console.WriteLine(responseString);
it is displayed in the Output window
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello!
I am trying to do a HttpWebRequest
to the below URL. When I do that, I return an empty string.
However, when I put the URL manually in the chrome browser. There is a large JSON string on this URL.
I wonder why I return an empy string with the below URL?
Thank you!
try
{
String URL = "https://api.etherscan.io/api?module=account&action=txlist&address=0xea482c608fedbaebb2bee4456d19acb3270f8355&startblock=12226259&endblock=99999999&sort=asc&apikey=1BDWT2SMX7KPV21FXPT932GZPMX4";
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(URL);
myRequest.Timeout = 60000;
myRequest.Method = "GET";
myRequest.Accept = "application/json";
myRequest.ContentType = "application/json; charset=utf-8";
WebResponse myResponse = myRequest.GetResponse();
var response = (System.Net.HttpWebResponse)myRequest.GetResponse();
String responseString = new System.IO.StreamReader(response.GetResponseStream()).ReadToEnd();
MessageBox.Show(responseString);
}
catch(Exception ex) { MessageBox.Show(ex.ToString()); }
I just tested and the string is not empy
If you replace the MessageBox by :
Console.WriteLine(responseString);
it is displayed in the Output window