title: Get JSON in ASHX AJAX C#
body: <p>Have a script in Home.aspx:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
    function probarAjax() {
  
      var Publicaciones = {
        "Categoria": "Noticia"
      }
  
      $.ajax({
        type: "POST",
        url: "Controlador.ashx?accion=enviar",
        data: JSON.stringify(Publicaciones),
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function(data) {
          console.log(data);
        },
        error: function(XMLHttpRequest, textStatus, errorThrown) {
          alert(textStatus);
        }
  
      });
    }
  &lt;/script&gt;
  </code></pre>
  
  <p>Inside of Controlador.ashx:</p>
  
  <pre><code>public void ProcessRequest(HttpContext context) {
    context.Response.ContentType = "text/json";
  
    var categoria = string.Empty;
    JavaScriptSerializer javaSerialize = new JavaScriptSerializer();
    categoria = context.Request["Categoria"];
  
    var capaSeguridad = new { d = categoria };
  
    context.Response.Write(javaSerialize.Serialize(capaSeguridad));
  }
  </code></pre>
  
  <p>And the result is :</p>
  
  <pre><code>Object {d: null} 
  </code></pre>
  
  <p>Why this result? if i send a parameter in the data with the variable <code>Publicaciones</code> with value <code>"Noticia"</code>.</p>