title: How to solve the Proxy Server 407 error in .NET.CORE
body: <p>SO i have some code that accesses the html of a website given  it woks but only in visualstudios.Framework for c#   when this code is input into the  app.config.</p>
  
  <pre><code>    &lt;system.net&gt; &lt;defaultProxy useDefaultCredentials="true" /&gt; &lt;/system.net&gt;
  </code></pre>
  
  <p>ps next line between the >&lt;</p>
  
  <p>but i need this code to work in .CORE instead of .FRAMEWORK 
  but it gives this error.</p>
  
  <p>System.Net.WebException: 'The remote server returned an error: (407) Proxy Authentication Required.' </p>
  
  <p>i tried solving it by creating a app.config from the solution explorer , but to no affect did it work 
  all the answers on the internet are either too complicated or it shows that little bit of code i put in the app.config  of .FRAMEWORK which does not work on .Core</p>
  
  <p>the code as a starting point.</p>
  
  <pre><code>     HttpWebRequest request = (HttpWebRequest)WebRequest.Create(urlAddress);
          HttpWebResponse response = (HttpWebResponse)request.GetResponse();
          if (response.StatusCode == HttpStatusCode.OK)
          {
              Stream receiveStream = response.GetResponseStream();
              StreamReader readStream = null;
              if (response.CharacterSet == null)
              {
                  readStream = new StreamReader(receiveStream);
                  Console.WriteLine("Sorry , somethings faulty");
  
              }
              else
              {
                  readStream = new StreamReader(receiveStream, Encoding.GetEncoding(response.CharacterSet));
                  readStream.ToString();
                  // Console.WriteLine(readStream);
              }
              string ImpureTexta = readStream.ReadToEnd().ToString();
              BaseHTML = ImpureTexta;  ///turns ImpureText in class to the actual html code so it can be used by entire program
              Console.WriteLine(BaseHTML);
              Console.WriteLine(" &lt;--------------------------------Extraction  B Complete ---------------------------------&gt;");
          }
  </code></pre>
  
  <p>Thanks</p>