title: WebClient UploadString
body: <p>have a problem.</p>
  
  <p>While post-processing with Web service I am getting error</p>
  
  <pre><code>    iqws webservis = new iqws();
      WebClient wc = new WebClient();
      var ser = new JavaScriptSerializer();
      var serializedResult = ser.Serialize(webservis.getProducts());
      wc.Headers[HttpRequestHeader.ContentType] = "application/json";
      string result = wc.UploadString("http://localhost:3523/WS/iqws.asmx/getProducts", serializedResult);
      var table = ser.Deserialize&lt;Dictionary&lt;string, dynamic&gt;&gt;(result);
  </code></pre>
  
  <p>But have error : <strong>The remote server returned an error: (500) Internal Server Error.</strong></p>
  
  <p>Why?</p>
  
  <pre><code>[WebService(Namespace = "http://tempuri.org/")]
  [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
  [ScriptService]
  public class iqws : System.Web.Services.WebService
  {
      [WebMethod]
      [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
      public string getProducts()
      {
          List&lt;products&gt; prd= new List&lt;products&gt;();
          SqlConnection cn = new SqlConnection(ado.cnStr);
          SqlCommand cmd = new SqlCommand("SELECT * FROM products", cn);
          cn.Open();
          SqlDataReader dr = cmd.ExecuteReader();
          while (dr.Read())
          {
              products p = new products();
              p.name = dr["name"].ToString();
              p.money = dr["money"].ToString();
              prd.Add(p);
          }
          var jsonSerialiser = new JavaScriptSerializer();
          return jsonSerialiser.Serialize(prd);
      }
  }
  </code></pre>
  
  <p>And json post no problem..</p>
  
  <pre><code>$.ajax({
      type: "POST",
      url: "/WS/iqws.asmx/getProducts",
      contentType: "application/json; charset=utf-8",
      //data: {},
      dataType: "json",
      success: function (data) {
          $("#jsonvalue").html(data.d);
      },
      error: function (xhr, status, error) {
          $("#jsonvalue").html(xhr.responseText);
      }
  });
  </code></pre>
  
  <p>And result;</p>
  
  <pre><code>[
    {
      "name": "iPhone 4s Gold",
      "code": null,
      "money": "1899,0000",
      "images": null,
      "comments": null
    },
    {
      "name": "iPhone 5s Black",
      "code": null,
      "money": "2000,0000",
      "images": null,
      "comments": null
    }
  ]
  </code></pre>
  
  <p>Why am I getting error?</p>