title: Stream does not support reading when placing a HTTP Post request
body: <p>I am facing an error that is "Stream does not support reading". I am placing a Http post request to the url. Below is my code that what i am using </p>
  
  <pre><code>var request = (HttpWebRequest) WebRequest.Create("https://test.com/Hotel Hospitality Source?method=fetchInfo");
  
  var postData = "&amp;username=testing";
  postData += "&amp;password=Testing";
  postData += "&amp;hotelId=h075-103";
  var data = Encoding.ASCII.GetBytes(postData);
  
  request.Method = "POST";
  request.ContentType = "application/x-www-form-urlencoded";
  request.ContentLength = data.Length;
  using(var ms = new MemoryStream())
  request.GetRequestStream().CopyTo(ms);
  
  var response = (HttpWebResponse) request.GetResponse();
  
  var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
  </code></pre>
  
  <p>Firstly I have used below code.</p>
  
  <pre><code> using (var stream = request.GetRequestStream())
   {
       stream.Write(data, 0, data.Length);
   }
  
   var response = (HttpWebResponse)request.GetResponse();
  
   var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/lxq8S.png" alt="enter image description here"></p>
  
  <p>I am getting error when I am using CopyTo method for stream. How can I resolve this error?</p>