Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4006602
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:32:03+00:00 2026-05-20T08:32:03+00:00

I was trying to use GET and ran into trouble. Now I am trying

  • 0

I was trying to use GET and ran into trouble. Now I am trying to switch to POST to try it out. I switched my jquery statements from

Type: GET,

to

Type: POST,

I switched my .asmx code behind to

[WebMethod(EnableSession = true)]
[ScriptMethod]
public string testGetParametersDynamic(string firstName, string lastName)
{
    string fullName = firstName + lastName;

    return fullName;
}

from

[WebMethod(EnableSession = true)]
[ScriptMethod(UseHttpGet = true)]
public string testGetParametersDynamic(string firstName, string lastName)
{
    string fullName = firstName + lastName;

    return fullName;
}

I am now getting this error:

An attempt was made to call the method \testGetParametersDynamic\u0027 using a GET request

what am I missing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T08:32:04+00:00Added an answer on May 20, 2026 at 8:32 am

    Add following attribute to service

    [System.Web.Script.Services.ScriptService]
    public class WebService : System.Web.Services.WebService
    

    EDIT

    Check out the following code.It’s working fine

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default5.aspx.cs" Inherits="Default5" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(document).ready(function () {
    
                $("#btnTest").click(function () {
                    var firstName = "a";
                    var lastName = "b";
                    $.ajax({
                        type: "POST",
                        data: "{firstName:'" + firstName + "',lastName:'" + lastName + "'}",
                        url: "WebService.asmx/testGetParametersDynamic",
                        contentType: "application/json",
                        dataType: "json",
                        success: function (ret) {
                            alert(ret);
                        }
    
    
                    }
    
                    );
                });
            });
    
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <input type="button" name="name" value="Call " id="btnTest" />
        </div>
        </form>
    </body>
    </html>
    

    WebService.asmx

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Services;
    using System.Web.Script.Services;
    
    
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    [System.Web.Script.Services.ScriptService]
    public class WebService : System.Web.Services.WebService
    {
    
        public WebService()
        {
    
    
        }
    
        [WebMethod(EnableSession = true)]
        [ScriptMethod]
        public string testGetParametersDynamic(string firstName, string lastName)
        {
            string fullName = firstName + lastName;
    
            return fullName;
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been pulling my hair out trying to use jQuery.get() to pull in my
I'm trying to use the function below to get a DIV to slide-out from
So I am running into this problem. I am trying to use $.get() to
I'm trying to use the jQuery get function to render the results of an
I'm trying to use a simple HTTP get to load a string from a
I'm trying to get a small twitter client running and I ran into a
We're trying to use Struts 2 Validation w/ Annotations and we've ran into a
I'm trying to use scalaz validation in our project and have ran into a
im currently learning jQuery and have ran into a problem. I am trying to
Ran into a bit of trouble when trying to insert records into my DB

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.