title: AngularJS Post data as key-value pair to a asp.net page
body: <p>I am trying to post key-value pair data from angular application to a asp.net page however I am not able to receive the result at the asp.net page.</p>
  
  <p><strong>Example Data</strong></p>
  
  <pre><code> {fullName: "Vikas Bansal", userId: "1001387693259813", userimageurl: "http://graph.facebook.com/1001387693259813/picture?width=250&amp;height=250"}
  </code></pre>
  
  <p><strong>Angular Code</strong></p>
  
  <pre><code>    var postData = {
          fullName: $scope.name,
          userId: $scope.userId,
          userimageurl: $scope.userImage
      };
  
      var postUrl = 'http://localhost:41115/Index.aspx';
  
      $http({
          url: postUrl,
          method: "POST",
          headers: {
              'Content-Type': 'application/x-www-form-urlencoded'
          },
          data: postData
      }).then(function (responce) {
          console.log(responce);
      }, function (responce) {
          console.log(responce);
      });
  </code></pre>
  
  <p><strong>Asp.net Page Code</strong></p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
      var userId = Request.Form["userId"];    /// getting null
      var fullName = Request.Form["fullName"];    /// getting null
      var img = Request.Form["userimageurl"]; /// getting null
  }
  </code></pre>
  
  <p>In asp.net page all variables are null.</p>
  
  <p><a href="https://i.stack.imgur.com/NrcYQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NrcYQ.png" alt="enter image description here"></a></p>
  
  <p><strong>EDIT</strong></p>
  
  <p>By changing content type to <code>'Content-Type': 'application/json; charset=utf-8'</code> in angularJs post request </p>
  
  <p>and by using <code>var strJSON = (new StreamReader(Request.InputStream).ReadToEnd());</code> I am able get the posted json </p>
  
  <p>but I am still wondering if there is a way to get key-value pairs directly?</p>
  
  <p>like this <code>var userId = Request.Form["userId"];</code></p>