Main Site Documentation

HttpWebRequest & HttpWebResponse missing assembly reference


#1

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;
            }

        }

#2

you could search the api libraries linked to under https://www.ghielectronics.com/support/netmf but i often find it quicker to just google the class and include NETMF as a keyword (sometime the version as well). For instance try the string [quote]NETMF HttpWebRequest 4.3[/quote]


#3

I got better result when using Bing, just saying :wink:

http://www.bing.com/search?q=NETMF+HttpWebRequest+4.3&qs=n&form=QBLH&pq=netmf+httpwebrequest+4.3

and you can always try this:

http://codesnippet.research.microsoft.com/

cheers,
jay…


#4

::slight_smile:


#5

thanks :slight_smile: