title: Ajax call to web method not working with content type set to ` application/json; charset=utf-8`
body: <p>I am trying to pass an array to c# webmethod using jquery ajax.</p>
  
  <p>The code below works fine with C# 4.0 but creates the following exception with c# 2.0.
  Anyone knows how to solve this? </p>
  
  <h2><strong>javascript code</strong></h2>
  
  <pre><code>var myarray=new Array();
      $.ajax({
              type: "POST",
              dataType: 'json',
              contentType: "application/json; charset=utf-8",
              url: "ClientSideMethods.asmx/ArrayTest",
              data: { "values": JSON.stringify(myarray) }
          }
          ).complete(function (data) {
              alert('complete');
          });
  </code></pre>
  
  <h2><strong>c# code</strong></h2>
  
  <pre><code>[WebMethod(EnableSession = true)]
  public void ArrayTest(List&lt;string&gt; values)
  {
      ...
  }
  </code></pre>
  
  <h2><strong>Exception</strong>(<em>From firebug)</em></h2>
  
  <pre><code>System.InvalidOperationException: Request format is invalid: application/json; charset=utf-8.
     at System.Web.Services.Protocols.HttpServerProtocol.ReadParameters()
     at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()
  </code></pre>
  
  <p><strong>edit:</strong>  If I remove <code>contentType: "application/json; charset=utf-8",</code> the post will work, but the values are not received as an array</p>
  
  <p><strong>Edit:</strong> when I change content type to <code>contentType: "application/json</code> the following error occurs</p>
  
  <pre><code>System.InvalidOperationException: AnywhereLogin Web Service method name is not valid.
     at System.Web.Services.Protocols.HttpServerProtocol.Initialize()
     at System.Web.Services.Protocols.ServerProtocol.SetContext(Type type, HttpContext context, HttpRequest request, HttpResponse response)
     at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean&amp; abortProcessing)
  </code></pre>