title: C# WebRequest GET/POST
body: <p>So I thought it's time for me to learn C#, be easy with me guys, I'm very new to this.</p>
  
  <p>I'm trying to create a very simple application (I'm using Windows Forms Application).
  My goal is:</p>
  
  <ol>
  <li>Using "GET" method, get the web page</li>
  <li>Read a text field (this value changes every time that the user is accessing the page</li>
  <li>Using "POST" method, send some values accordingly</li>
  </ol>
  
  <p>Here is my code so far:</p>
  
  <pre><code>  private void button2_Click(object sender, EventArgs e)
  {
      string URI = "http://localhost/post.php";
      string myParameters = "field=value1&amp;field2=value2";
  
      using (WebClient wc = new WebClient())
      {
          string getpage = wc.DownloadString("http://localhost/post.php");
          MessageBox.Show(getpage);
          wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
          string HtmlResult = wc.UploadString(URI, myParameters);
          MessageBox.Show(HtmlResult);
      }
  }
  </code></pre>
  
  <p>So far so good, It's working but it's not entirely what I want to achieve here.
  I'm able to use POST method, but how do I use GET before sending the data? 
  I want to send data according to GET result.</p>
  
  <p>Please let me know if I should be giving a better description to what I'm trying to do.</p>
  
  <p>Thanks.</p>
  
  <p><strong>Edit</strong><br/>
  This is my PHP Code:</p>
  
  <pre><code>&lt;?php
  
      $a = session_id();
  
      if(empty($a))
          session_start();
  
          echo "Session: ".session_id()."&lt;br/&gt;\n";
  </code></pre>
  
  <p>Now, back to my C# code, I get different session ID in the two messages </p>