title: simulate ajax call using C#
body: <p>I am making an ajax call to a local resource like this</p>
  
  <pre><code>$.ajax({
                      url: 'http://localhost:10001',
                      dataType: "text",
                      data: { a: 'aVal',b: 'bVal',message: 'message' },
                      success: function (data) {
                          $("#test").append(data);
                      },
                      error: function (jqXHR,textStatus,errorThrown) {
                          alert('error '+textStatus+" "+errorThrown);
                      }
                  });
  </code></pre>
  
  <p>Now i just want to simulate the call from C#.
  I am able to make a raw call using this code</p>
  
  <pre><code> WebRequest request = WebRequest.Create("http://localhost:10001");
   request.ContentType = "text";
  HttpWebResponse response = (HttpWebResponse)request.GetResponse();
  </code></pre>
  
  <p>i dont know how to send the data along.If there is a better way, kindly suggest</p>
  
  <hr>
  
  <p><strong>Also,</strong> I want this to have the exact structure and appearance because i am handling the request at the node js server like this</p>
  
  <pre><code>var url=require('url');
  var url_parts=url.parse(request.url,true);
  var data=url_parts.query;
  </code></pre>
  
  <p>Thanks</p>