title: 403 Forbidden error REST Call
body: <p>I am building a REST Client in C#. I am getting forbidden 403 error. Here is my code</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Net;
  using System.IO;
  using System.Web;
  using restservice.webref;
  using System.Windows.Forms;
  using System.Runtime.Serialization;
  using System.Net.Http;
  using System.Net.Http.Headers;
  using System.Threading.Tasks;
  
  
  namespace restservice
  {
      class getUUID
      {
          private const string URL = "http://XXX.XXXX.com/ws410/XXXXX/XX/XX";
          public void getProductID()
          {
              HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL);
              request.Method = "GET";
  
          request.Credentials = new NetworkCredential("XXXX", "XX");
          request.Accept = @"text/html, application/xhtml+xml, */*";
          request.Referer = @"http://www.somesite.com/";
          request.Headers.Add("Accept-Language", "en-GB");
          request.UserAgent = @"Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)";
          request.Host = @"www.my.XXX.com";
          request.UseDefaultCredentials = true;
          request.Proxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
          request.ContentType = "application/json";
          /*StreamWriter requestWriter = new StreamWriter(request.GetRequestStream(), System.Text.Encoding.ASCII);
          requestWriter.Write(false);
          requestWriter.Close();*/
          try
          {
              HttpWebResponse response = (HttpWebResponse)request.GetResponse();
              using (var reader = new StreamReader(response.GetResponseStream()))
              {
                  String htmlString = reader.ReadToEnd();
              }
              /*
              WebResponse webResponse = request.GetResponse();
              Stream webStream = webResponse.GetResponseStream();
              StreamReader responseReader = new StreamReader(webStream);
              string response = responseReader.ReadToEnd();
              Console.Out.WriteLine(response);
              responseReader.Close();*/
          }
          catch (Exception e)
          {
              Console.Out.WriteLine(e.Message);
          }
  
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I have also given the credentials as well as enabled the default credentials. Still I get the 403 error. 
  Please can you help?</p>