title: How to pass json string to webmethod c# ASP.NET
body: <p>Im trying to stringify a javascript object and then pass the string as a parameter to a WebMethod in Code Behind. I can't get it to work as I get a Internal Server Error of 500 and the stacktrace says that value is missing for parameter.</p>
  
  <p>Here is the javascript code:</p>
  
  <pre><code>var jSon = JSON.stringify(javascriptObject); 
  // "{"Foretagsnamn":"Avector","BGFarg":"000000","TextColor":"fafafa","FooterFarg":"ffffff","FooterColor":"000000","FooterLinkColor":"050505","FeaturedBorderColor":"","HoverFarg":"12ebeb","RutFarg":"0d0d0d","SelectedRutFarg":"","RutColor":"FFFFFF","LankColor":"","DelaMedSig":"1","PersonalSida":"0","StartpageTitle":"","StartpageDescription":"","GoogleMaps":"&lt;iframe width=\"425\" height=\"350\" frameborder=\"0\" scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\" src=\"https://maps.google.se/maps?f=q&amp;amp;source=embed&amp;amp;hl=sv&amp;amp;geocode=&amp;amp;q=Avector AB&amp;amp;aq=&amp;amp;sll=56.225986,12.870827&amp;amp;sspn=0.076248,0.154324&amp;amp;ie=UTF8&amp;amp;hq=Avector AB&amp;amp;hnear=&amp;amp;t=m&amp;amp;cid=645910733081021950&amp;amp;iwloc=A&amp;amp;ll=56.224594,12.859229&amp;amp;spn=0,0&amp;amp;output=embed\"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;small&gt;&lt;a href=\"https://maps.google.se/maps?f=q&amp;amp;source=embed&amp;amp;hl=sv&amp;amp;geocode=&amp;amp;q=Avector AB&amp;amp;aq=&amp;amp;sll=56.225986,12.870827&amp;amp;sspn=0.076248,0.154324&amp;amp;ie=UTF8&amp;amp;hq=Avector AB&amp;amp;hnear=&amp;amp;t=m&amp;amp;cid=645910733081021950&amp;amp;iwloc=A&amp;amp;ll=56.224594,12.859229&amp;amp;spn=0,0\" style=\"text-align:left\"&gt;Visa större karta&lt;/a&gt;&lt;/small&gt;","HittaKartaUrl":"http://www.hitta.se/avector ab/ängelholm/hxTP-4v1HG?vad=Avector AB","EniroKartaUrl":"http://kartor.eniro.se/m/aKkhi","Ikoner":"2","Email":"info@avector.com","AdressSida":"1","shadowColor":"ffffff","lineColor":"2b292b","MenuHoverIcon":"Välj bild från server","fontFamily":"Verdana","supportText":"Support Avector","captcha":true,"metaKeywords":"","ShowSupportInFooter":true}"
  
  $.ajax({
      type: "POST",
      url: "Post/Installningar.aspx/Updatera",
      data: jSon,
      contentType: "application/json; charset=utf-8",
      dataType: "json",
      success: function (result) {
  
          var resultAsString = result.d;
          //_this.parent().siblings('.SavedStatus').html(resultAsString);
  
          if (resultAsString == "1") { // Gick bra att spara.
             alert("Uppgifterna är sparade.");
             document.location = document.location;
          }
          else {
             $('#StatusText').html("Gick inte att spara uppgifterna.");
          }
  
  
      },
      error: function (xhr, ajaxOptions, thrownError) {
  
      }
  });
  </code></pre>
  
  <p>And here Is the webmethod:</p>
  
  <pre><code>[WebMethod]
  public static string Updatera(string jSon)
  {
  </code></pre>
  
  <p>It feels like I've tried everything that I've found when searching by google and here on SO.</p>
  
  <p>I've also tried this guide that many refer to: <a href="http://encosia.com/using-jquery-to-directly-call-aspnet-ajax-page-methods/" rel="nofollow">http://encosia.com/using-jquery-to-directly-call-aspnet-ajax-page-methods/</a></p>
  
  <p>Any ideas?</p>