3

I have a webmethod

[WebMethod]
public static string GetVendorData(List<VendorData> LstVendorData)
{
       //something
}

and call it from a ajax method

 $.ajax({
      type: "POST",
      url: "/WebMethods/AjaxProcessorPage.aspx/GetVendorData",
      ...
      ....

This works fine form Content Authoring, but doesn't work on Content delivery. I included /WebMethods/AjaxProcessorPage.aspx in the setting name="ignoreUrlprefixes" ... also, but not luck. What could be the issue?

3
  • Could you provide the error? Nov 15 '17 at 15:41
  • Komahan can you hit the endpoint (/WebMethods/AjaxProcessorPage.aspx/GetVendorData) and get a response? or do you get a 404 or other error? Nov 15 '17 at 17:02
  • Could you post the entirety of the ajax call @Komahan? Curious if you have have content type set (ie: contentType: "application/json; charset=utf-8",)
    – vandsh
    Dec 15 '17 at 16:58
0

Try this:

[HttpPost]
[WebMethod]
public static string GetVendorData(List<VendorData> LstVendorData)
{
       //something
}

or

$.ajax({
      type: "POST",
      url: "/WebMethods/AjaxProcessorPage.aspx/GetVendorData",
      data: JSON.stringify(params),
      ....
0

Here are a few things you can try:

1- Use a tool like postman or whatever is your preference to emulate a post to that url. You need to check whether you can reach it or not. Andrei's answer suggest an approach calling directly with an ajax call which helps aslo. 2- In case you can't reach your next try is the routing table to see why you can't reach that method.

Not the answer you're looking for? Browse other questions tagged or ask your own question.