title: convert context.Request.Params to C# properties in generic handler
body: <p>I am using jquery ajax with generic handle to submit my record to sql server 2012 database but my code "List PP" returning null value so that i can not insert data in database table.
  I want to add JSON.stringify values in c# properties and insert it into database.
  Here is my code sample</p>
  
  <p><strong>Jquery ajax</strong></p>
  
  <pre><code>var P = {};
                P.PatnerFormsName = $("[id*=txtpatnername]").val();
                P.PatnerFormsAddress = $("[id*=txtaddress]").val();
                var fileUpload = $("#Upload").get(0);
                var files = fileUpload.files;
                var test = new FormData();
                for (var i = 0; i &lt; files.length; i++) {
                    test.append(files[i].name, files[i]);
                }
                test.append("P",  JSON.stringify(P) );
  
                $.ajax({
                    url: "UploadHandler.ashx",
                    type: "POST",
                    contentType: false,
                    processData: false,
                    data: test,
                    // dataType: "json",
                    success: function (result) {
                        alert(result);
                    },
                    error: function (err) {
                        alert(err.statusText);
                    }
                });
  </code></pre>
  
  <p><strong>Properties Class:</strong></p>
  
  <pre><code>public class Properties
  {
  
      // Insertion Area Start //
  
      // Patner Form Start //
      public string PatnerFormsName { get; set; }
      public string PatnerFormsAddress { get; set; }
  
  }
  </code></pre>
  
  <p><strong>Generic Handler</strong></p>
  
  <pre><code>public void ProcessRequest (HttpContext context) {
  
  
  
          if (context.Request.Files.Count &gt; 0)
          {
              Properties P = new Properties();
              JavaScriptSerializer js = new JavaScriptSerializer();
              var param = context.Request.Params["P"];
              List&lt;Properties&gt; PP = new List&lt;Properties&gt;();
  
              PP = (List&lt;Properties&gt;)js.Deserialize(param, typeof(List&lt;Properties&gt;));
  
              foreach (var item in PP)
              {
                  context.Response.Write(item.PatnerFormsAddress);
                 using (SqlCommand cmd = new SqlCommand())
                  {
                      cmd.CommandType = CommandType.StoredProcedure;
                      cmd.CommandText = "sp_test";
                      cmd.Connection = Getconnected.getconnecting();
                      cmd.Parameters.AddWithValue("@Name", P.PatnerFormsAddress);
                      cmd.Parameters.AddWithValue("@Address", P.PatnerFormsAddress);
                      cmd.ExecuteNonQuery();
                  }
  
              }
  
  
              HttpFileCollection files = context.Request.Files;
              for (int i = 0; i &lt; files.Count; i++)
              {
                  HttpPostedFile file = files[i];
                  string fname;
                  if (HttpContext.Current.Request.Browser.Browser.ToUpper() == "IE" || HttpContext.Current.Request.Browser.Browser.ToUpper() == "INTERNETEXPLORER")
                  {
                      string[] testfiles = file.FileName.Split(new char[] { '\\' });
                      fname = testfiles[testfiles.Length - 1];
                  }
                  else
                  {
                      fname = "Logo" + file.FileName;
                  }
  
                  fname =Path.Combine(context.Server.MapPath("~/Images/Patner/"), fname);
                  file.SaveAs(fname);
  
  
              }
          }
  
      }
  </code></pre>