title: JSON can call method in .aspx file but not in .asmx (ASP.NET web service) file
body: <p>I am using JQuery &amp; JSON (POST) to call webmethod. However I can call only webmethod located at aspx file but not in asmx file</p>
  
  <p>Below are sample codes</p>
  
  <p>CustomValidate.asmx</p>
  
  <pre><code>Imports System.Web.Services
  Imports System.Web.Services.Protocols
  Imports System.ComponentModel
  
  
  Public Class CustomValidate
  Inherits System.Web.Services.WebService
  
  'ACCESS VIA JSON
  
  &lt;System.Web.Services.WebMethod()&gt; _
  Public Shared Function AJAX_Test(ByVal date1) As Boolean
  ...
  
      Return True
  End Function
  End Class
  </code></pre>
  
  <p>Javascript: JQuery JSON</p>
  
  <pre><code>function isDates(source, arguments) {
                  var isValidDate;
                  $.ajax({
                      type: "POST",
                      contentType: "application/json; charset=utf-8",
                      url: "CustomValidate.asmx/AJAX_Test",
                      data: '{date1: "' + arguments.Value + '"}',
                      dataType: "json",
                      async: false,
                      success: function(result) {
  
                          isValidDate = result;
                      },
                      error: function(httpRequest, textStatus, errorThrown) { 
                         alert("status=" + textStatus + ",error=" + errorThrown);
                      } 
  
                  });
                  arguments.IsValid = isValidDate;
              }
  </code></pre>
  
  <p>It always return javascript undefined error. But if I put the AJAX_Test webmethod in aspx page and replace the url: "CustomValidate.asmx/AJAX_Test" to "mypage.aspx/AJAX_Test". It works fine. Any idea?</p>