title: Calling WebMethod in URL in Web Forms Asp
body: <p>I have tried Web Form application for the first time. My aim is to enable the URLS to call methods such as by typing <a href="http://localhost:51040/test.aspx/GetData" rel="nofollow noreferrer">http://localhost:51040/test.aspx/GetData</a> on browser should call method GetData. Where GetData Method includes: </p>
  
  <pre><code>    [WebMethod()]
      public static string GetData()
      {
          person p = new person();
          Order o = new Order("gggg","fff",34);
          Database db = new Database();
          db.MakeOrder(o);
  
         // p.name = name;
          return p.name;
      }
  </code></pre>
  
  <p>I also tried Ajax function to call this method using POST request and it works when I click the button:</p>
  
  <pre><code>      $(document).ready(function () {
      $.support.cors = true;
  ]
  $('#btn').click(function () {
      var name = $('#name').val();
     /// alert("The btn was clicked.");
      jQuery.ajax({
          url: 'test.aspx/GetData',
          type: "POST",
          dataType: "json",
         // data: "{'name': '" + name + "'}",
          contentType: "application/json; charset=utf-8",
          success: function (data) {
              alert(JSON.stringify(data));
  
  
          }
      });
  });
  
  });
  </code></pre>
  
  <p>but I am still unable to call this method directly via  URL. I am so sorry if I did not deliver the complete information.However, if you need to know something else, I will try to provide you.
   I am anxiously waiting for helping reply.</p>