title: Authentication failed because the remote party has closed the transport stream exception when getting a response from webservice
body: <p>I am calling a third party service and when I ask for a response it throws out an exception that says </p>
  
  <blockquote>
    <p>"Authentication failed because the remote party has closed the transport stream exception".</p>
  </blockquote>
  
  <p>I think that there is a problem in sending credentials. I have even tried supplying new credentials. Here is the full code </p>
  
  <pre><code>string get_url = "https://**.*******.com/com/******/webservices/public_webservice.cfc?wsdl&amp;Method=CreateUser&amp;SiteID=**&amp;WSPassword=******&amp;UserName=******";
  HttpWebRequest request = (HttpWebRequest)WebRequest.Create(get_url);
  request.MaximumAutomaticRedirections = 4;
  request.MaximumResponseHeadersLength = 4;
  request.Credentials = CredentialCache.DefaultCredentials;
  //request.UseDefaultCredentials = false;
  //request.Credentials = new System.Net.NetworkCredential("*****", "*****");
  request.ContentType = "application/x-www-form-urlencoded; charset=ISO-8859-1";
  
  // Show the sent stream
  //lbl_send_stream.Text = send_stream;
  //lbl_send_stream.Text = get_url;
  // Get UserId And LoginToken From Third Party DB
  // ==============================================
  //Exception gets throwed When code hits here
  HttpWebResponse response = (HttpWebResponse)request.GetResponse();
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/bLNdf.png" rel="noreferrer"><img src="https://i.stack.imgur.com/bLNdf.png" alt="enter image description here"></a></p>