I am working getting data using HttpWebRequest and run into stream not readable error using the below code.
JavaScriptSerializer jss = new JavaScriptSerializer();
string getUrl = "http://url.com";
var getdata = "";
HttpWebRequest webrequest = (HttpWebRequest)WebRequest.Create(getUrl);
webrequest.Method = "GET";
webrequest.ContentType = "application/json";
webrequest.ContentLength = data.Length;
using (HttpWebResponse webresponse = (HttpWebResponse)request.GetResponse())
using (Stream stream = webresponse.GetResponseStream())
using (StreamReader reader = new StreamReader(stream)) //stream not readable error
{
getdata = reader.ReadToEnd();
}
dynamic getjsondata = jss.Deserialize<dynamic>(getdata);
Not sure where I am doing it wrong.