title: .NETCore HttpWebRequest - Old Way isn't Working
body: <p>Before I upgraded to the newest .NetCore I was able to run the HttpWebRequest, add the headers and content Type and pull the stream of the JSON file from Twitch. Since the upgrade this is not working. I receive a Web Exception each time I go to get the response Stream. Nothing has changed with twitch because it still works with the old Bot. The old code is below:</p>
  
  <pre><code>private const string Url = "https://api.twitch.tv/kraken/streams/channelname";
  HttpWebRequest request;
          try
          {
              request = (HttpWebRequest)WebRequest.Create(Url);
          }
  
          request.Method = "Get";
          request.Timeout = 12000;
          request.ContentType = "application/vnd.twitchtv.v5+json";
          request.Headers.Add("Client-ID", "ID");
          try
          {
              using (var s = request.GetResponse().GetResponseStream())
              {
                  if (s != null)
                      using (var sr = new StreamReader(s))
                      {
  
                      }
              }
          }
  </code></pre>
  
  <p>I have done some research and found that I may need to start using either an HttpClient or HttpRequestMessage. I have tried going about this but when adding headers content type the program halts and exits. after the first line here: (when using HttpsRequestMessage)</p>
  
  <pre><code>request.Content.Headers.ContentType.MediaType = "application/vnd.twitchtv.v5+json";
  request.Content.Headers.Add("Client-ID", "rbp1au0xk85ej6wac9b8s1a1amlsi5");
  </code></pre>