title: How to properly make a http web GET request
body: <p>i am still new on c# and i'm trying to create an application for this page that will tell me when i get a notification (answered, commented, etc..). But for now i'm just trying to make a simple call to the api which will get the user's data.</p>
  
  <p>i'm using Visual studio express 2012 to build the C# application, where (for now) you enter your user id, so the application will make the request with the user id and show the stats of this user id.</p>
  
  <p>here is the code where i'm trying to make the request:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  //Request library
  using System.Net;
  using System.IO;
  
  namespace TestApplication
  {
      class Connect
      {
          public string id;
          public string type;
  
          protected string api = "https://api.stackexchange.com/2.2/";
          protected string options = "?order=desc&amp;sort=name&amp;site=stackoverflow";
  
          public string request()
          {
              string totalUrl = this.join(id);
  
              return this.HttpGet(totalUrl);
          }
  
          protected string join(string s)
          {
              return api + type + "/" + s + options;
          }
  
          protected string get(string url)
          {
              try
              {
                  string rt;
  
                  WebRequest request = WebRequest.Create(url);
  
                  WebResponse response = request.GetResponse();
  
                  Stream dataStream = response.GetResponseStream();
  
                  StreamReader reader = new StreamReader(dataStream);
  
                  rt = reader.ReadToEnd();
  
                  Console.WriteLine(rt);
  
                  reader.Close();
                  response.Close();
  
                  return rt;
              }
  
              catch(Exception ex)
              {
                  return "Error: " + ex.Message;
              }
          }
          public string HttpGet(string URI)
          {
              WebClient client = new WebClient();
  
              // Add a user agent header in case the 
              // requested URI contains a query.
  
              client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
  
              Stream data = client.OpenRead(URI);
              StreamReader reader = new StreamReader(data);
              string s = reader.ReadToEnd();
              data.Close();
              reader.Close();
  
              return s;
          }
      }
  }
  </code></pre>
  
  <p>the class is an object and its being accessed from the form by just parsing it the user id and make the request.</p>
  
  <p>i have tried many of the examples i have looked on google, but not clue why i am getting on all ways this message "�".</p>
  
  <p>i am new in this kind of algorithm, if anyone can share a book or tutorial that shows how to do this kind of stuff (explaining each step), i would appreciate it</p>