title: JIRA error: Remote server returned error 407 proxy authentication required
body: <p>I'm trying to access JIRA data (get project) using JIRA REST API. Here is how I'm making it:</p>
  
  <pre><code>public enum JiraResource
  {
  project
  }
  
  public class JiraService : IJiraService
  {
      #region JiraService member functions
     /* public void DoWork()
      {
      }*/
  
      private const string str_baseURL = "https://jira.atlassian.com/rest/api/latest/issue/JRA-9";
  
      private string str_Username;
      private string str_Password;
  
      public JiraService(string username,string password)
      {
          str_Username = username;
          str_Password = password;
      }
      public string runQuery(
          JiraResource resource,
          string argument = null,
          string data = null,
          string method = "GET")
      {
          string url = string.Format("{0}{1}/",str_baseURL,resource.ToString());
         // string url = string.Format("{0}{1}/", str_baseURL);
          if(argument != null)
          {
              url = string.Format("{0}{1}/",url,argument);
          }
          HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
          request.ContentType = "application/json";
          request.Method = method;
          if (data != null)
          {
              using (StreamWriter writer = new StreamWriter(request.GetRequestStream()))
              {
                  writer.Write(data);
              }
          }
          string base64Credentials = GetEncodedCredentials();
          request.Headers.Add("Authorization", "Basic " + base64Credentials);
          HttpWebResponse response = request.GetResponse() as HttpWebResponse; //Getting error here.
          string result = string.Empty;
          using (StreamReader reader = new StreamReader(response.GetResponseStream()))
          { result = reader.ReadToEnd(); }
  
          return result;
      }
  
      private string GetEncodedCredentials()
      {
      string mergedCredentials = string.Format("{0}:{1}", str_Username, str_Password);
      byte[] byteCredentials = UTF8Encoding.UTF8.GetBytes(mergedCredentials);
      return Convert.ToBase64String(byteCredentials);
      }
  </code></pre>
  
  <p>I'm using username and password as admin and admin (I think this is default). Please note that, this url ("<a href="https://jira.atlassian.com/rest/api/latest/issue/JRA-9" rel="nofollow noreferrer">https://jira.atlassian.com/rest/api/latest/issue/JRA-9</a>") showing me json objects from the browser. However, from my code, I'm getting exception "Remote server returned error (407) proxy authentication required ".</p>
  
  <p>As per this post(<a href="https://stackoverflow.com/questions/2581609/the-remote-server-returned-an-error-407-proxy-authentication-required">The remote server returned an error: (407) Proxy Authentication Required</a>) I used useDefaultCredentials="true". But this is not working.</p>
  
  <p>Is there anything that I'm missing? Please guide me.</p>