title: Send HTTP Post Request through ASP.net
body: <p>I've hit a road block due to this problem in my project, Any kind of help will be highly appreciated.</p>
  
  <p>My problem is that I want users to  enter (their) destination &amp; email at my website. Then I'll take those values and fill in the text fields at the following website and then click the <strong>"request measurement button"</strong>. In short a simple HTTP Post request.</p>
  
  <p><a href="http://revtr.cs.washington.edu/" rel="nofollow">http://revtr.cs.washington.edu/</a></p>
  
  <p>My C# code is as follows:</p>
  
  <pre><code>    // variables to store parameter values
      string url = "http://revtr.cs.washington.edu/";
  
      // creates the post data for the POST request
      string postData = ("destination=www.thechive.com&amp;node=161&amp;email=abc%40xyz.edu.pk&amp;prediction=If+you+believe+you+know+the+traceroute+%28for+instance%2C+if+you+are+trying+out+our+system+using+a+destination+that+you+actually+control%29%2C+please+cut-and-paste+the+traceroute+into+this+box+to+aid+us+in+improving+our+system.");
  
      // create the POST request
      HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url);
      webRequest.Method = "POST";
      webRequest.ContentType = "application/x-www-form-urlencoded";
      webRequest.ContentLength = postData.Length;
  
      // POST the data
      using (StreamWriter requestWriter2 = new StreamWriter(webRequest.GetRequestStream()))
      {
          requestWriter2.Write(postData);
      }
  
      //  This actually does the request and gets the response back
      HttpWebResponse resp = (HttpWebResponse)webRequest.GetResponse();
  
      string responseData = string.Empty;
  
      using (StreamReader responseReader = new StreamReader(webRequest.GetResponse().GetResponseStream()))
      {
          // dumps the HTML from the response into a string variable
          responseData = responseReader.ReadToEnd();
      }
  
      //  Now, find the index of some word on the page that would be 
      //     displayed if the login was successful
      int index = responseData.IndexOf("Measuring");
  
      if (index &gt; -1)
          ListBox1.Items.Add("SUCCESS");
  </code></pre>
  
  <p>But the <strong>responseData</strong> shows that the BUTTON hasn't been clicked when the program is run (I got this info from debugger of VS2010)</p>