title: Reading XML from REST API
body: <p>I am writing a small console application in C# to send a request to REST API and receive the response in XML. below is my code </p>
  
  <pre><code> using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
              {
                  StreamReader reader = new StreamReader(response.GetResponseStream());
                  XmlDocument xmlDoc = new XmlDocument();
                  xmlDoc.Load(reader.ReadToEnd());
                  Console.Write(xmlDoc);
  
              } 
  </code></pre>
  
  <p>I have checked using the fiddler and i am getting 200 response code and result. but while doing  <code>xmlDoc.Load(reader.ReadToEnd());</code> i am getting error. </p>
  
  <p>Can any one help me to solve this? or is there any other way to do this. </p>
  
  <p><strong>I want to write the response XML result into file.</strong> </p>
  
  <p>Thanks in advance </p>