jQuery ajax POST in Sitecore duplicates method name

I have an ASMX service located at Website\sitecore\shell\WebService\Validate.asmx

    public class Validate : System.Web.Services.WebService
        [ScriptMethod(ResponseFormat = ResponseFormat.Json, XmlSerializeString = false)]
        public PersonValidationResult ValidateNaturalPerson(string pk)
            var valResult = PROC.ODSHelper.ValidateNaturalPerson(pk);
            return valResult;

I'm trying to call the ValidateNaturalPerson method on textbox blur:

 pkRegNum = $("#txtPerson").val();
 var options = {
                type: "POST",
                dataType: "json",
                contentType: "application/json; charset=utf-8",
                url: '/sitecore/shell/webservice/validate.asmx/ValidateNaturalPerson', 
                data: '{"pk":"'+pkRegNum+'"}',
                success: function (response) {
                    HandleNaturalPersonResponse(response.d, source, pkRegNum);
                error: function (a, b, c) {

Pretty simple stuff. However on POST I keep getting HTTP 500 errors. When I check the response in Firebug it shows:

[ArgumentException: Unknown web method ValidateNaturalPerson/ValidateNaturalPerson.
Parameter name: methodName]
   System.Web.Script.Services.RestHandler.CreateHandler(WebServiceData webServiceData, String methodName) +758655
   System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated) +89

Any ideas where the ValidateNaturalPerson/ValidateNaturalPerson comes from? I assume it's the Sitecore messing with the request. I tried changing the URL in ajax beforeSend event, tried all kinds of ScriptMethod/WebMethod and POST/GET combinations but with no luck...


If you assume Sitecore is messing with your request you can tell Sitecore to ignore this request, so Sitecore won't intervene. You can do this by adding the page you've added to the "IgnoreUrlPrefix" setting in your web.config for your solution. Correct me if I'm wrong, but that should possibly do the trick.

Looks like the error one would normally get when failing to make a Page Method static. In this case 'ValidateNaturalPerson'. Given that this is not a Page Method though, I'm not sure why it would apply here.

page web method not working in ajax call where web service method is calling perfectly

Need Your Help

Get entity subclass without instanceOf

java hibernate entity hierarchy

I have a scenario where I have a entity hierarchy structure implemented in hibernate.

Activity struck while pressing back key

android android-activity listactivity

There is no action performed on the activity when i press back key till some time. No code return to handle back key in my activity. I am starting a activity when user clicks on list item. Like

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.