Netduino home hardware projects downloads community

Jump to content

The Netduino forums have been replaced by new forums at This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.

How to send and recieve a http webrequest ?

  • Please log in to reply
No replies to this topic

#1 Archimede



  • Validating
  • PipPip
  • 15 posts

Posted 15 May 2016 - 08:41 PM

hello everybody :) ,
i took this code in internet to test a simple http request, but i have this exception: Eccezione first-chance di tipo 'System.Exception' in mscorlib.dll...
I am using netduino plus 2 .net micro framework 4.2
My goal is to send and to recieve the data from telegram's server(telegram is an application).
The code is the following:
using System;
using Microsoft.SPOT;
using System.Net;
using System.IO;
using System.Text;



class MyHttpRequest
        public MyHttpRequest()
        public void Mymethod()
            // Create a request for the URL. 
           WebRequest request = WebRequest.Create("");  //here i have the exception
            // Get the response.
            WebResponse response = request.GetResponse();
// Display the status.
            // Get the stream containing content returned by the server.
            Stream dataStream = response.GetResponseStream();
            // Open the stream using a StreamReader for easy access.
            StreamReader reader = new StreamReader(dataStream);
            // Read the content.
            string responseFromServer = reader.ReadToEnd();  //here i have the error when use URL:
            // Display the content.
            // Clean up the streams and the response.
Can i  use the WebRequest class if my URL is a https? :wacko:
because when i change the url(for example have another exception : 
Eccezione first-chance di tipo 'System.ArgumentOutOfRangeException' in mscorlib.dll
if you can help me (if it is possible to write the code...) 
Thank you

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.