title: Using both POST and GET Ajax calls for the same WebMethod in ASMX Web Service
body: <p>I can't seem to call a web service method from Ajax with both POST and GET.</p>
  
  <p>Initially only the POST would work and GET would causes this error:</p>
  
  <blockquote>
    <p>{"Message":"An attempt was made to
    call the method \u0027getData\u0027
    using a GET request, which is not
    allowed.","StackTrace":"   at
    System.Web.Script.Services.RestHandler.GetRawParams(WebServiceMethodData
    methodData, HttpContext context)\r\n<br>
    at
    System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext
    context, WebServiceMethodData
    methodData)","ExceptionType":"System.InvalidOperationException"}</p>
  </blockquote>
  
  <p>I fixed that by adding this attribute: <code>[ScriptMethod(UseHttpGet=true)]</code> but now GET causes this error:</p>
  
  <blockquote>
    <p>{"Message":"An attempt was made to
    call the method \u0027getData\u0027
    using a POST request, which is not
    allowed.","StackTrace":"   at
    System.Web.Script.Services.RestHandler.GetRawParams(WebServiceMethodData
    methodData, HttpContext context)\r\n<br>
    at
    System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext
    context, WebServiceMethodData
    methodData)","ExceptionType":"System.InvalidOperationException"}</p>
  </blockquote>
  
  <p>So is it true that you can only use either POST or GET and not both from Ajax?  Does anyone know why this occurs or if there is a workaround?</p>
  
  <p>Thanks in advance!</p>