4
ERROR: unknown web method DoIt Parameter name: methodName

I'm trying to pass a date into a DB Query function backended by VB.NET but am having problems with the webside of things.

var dat = $("#Date").val(); //textbox with a date    

$.ajax({
                    type: "POST",
                    url: "file.aspx/DoIt",
                    cache: false,
                    contentType: "application/json; charset=utf-8",
                    data: {param:dat},
                    dataType: "json",
                    success: function (data, status) {
                        var response = $.parseJSON(data.d);
                        alert(response.message);
                        alert(status);
                    },
                    error: function (xmlRequest) {
                        alert(xmlRequest.status + ' \n\r ' + xmlRequest.statusText + '\n\r' + xmlRequest.responseText);
                    }
                });     

The file.aspx.vb file:

(at the end of the file)

<System.Web.Services.WebMethod()> _
Public Function DoIt(ByVal param As String) As String
    UpdateDB(param) 'function is above
End Function

I'm just not entirely sure whats going wrong or what it means ;/

3
  • can you tell us more about where you see the error message and what exactly it says? Commented Apr 2, 2012 at 20:03
  • Really just a 500 error with "unknown web method DoIt Parameter name: methodName" Commented Apr 2, 2012 at 20:07
  • ...and you are getting that error in the javascript ajax response? Commented Apr 2, 2012 at 20:13

2 Answers 2

3

Check out this answer. You may need to declare the function as Shared

<System.Web.Services.WebMethod()> _
Public Shared Function DoIt(ByVal param As String) As String
    UpdateDB(param) 'function is above
End Function
Sign up to request clarification or add additional context in comments.

Comments

2

Something that might be worth checking out is to ensure that your database is setup to receive a datetime datatype.

Also something to try in your web-service declaration:

<ScriptMethod(ResponseFormat:=ResponseFormat.Json)> _
<WebMethod()> _
Public Function DoIt(ByVal param As String) As String
    UpdateDB(param) 'function is above
End Function

Reference: webservice - unknown web method parameter name methodname

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.