Hi
I am work with send and receive data to/from JSON server using ENC28 module.
Have found a code sample but can not find the right reference?
This is maybe a stupid question :whistle:
thanks for any inconvenience
Error.
The type or namespace name ‘HttpWebRequest’ could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name ‘HttpWebResponse’ could not be found (are you missing a using directive or an assembly reference?)
public static void senddata()
{
var webAddr = "http://Domain...";
var httpWebRequest = (HttpWebRequest)WebRequest.Create(webAddr);
//var httpWebRequest = (HttpWebRequest)WebRequest.Create(webAddr);
httpWebRequest.ContentType = "application/json; charset=utf-8";
httpWebRequest.Method = "POST";
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
{
string json = "{\"x\":\"true\"}";
streamWriter.Write(json);
streamWriter.Flush();
}
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
var result = streamReader.ReadToEnd();
//return result;
}
}