Configuring asp.net 2.0 webmethod as GET method

But by default, you should issue an HTTP POST to any web method in the asp.net 2.0 web service. How do you call a web method with HTTP GET only. In some cases, I would also like to pass arguments to the HTTP GET method. Is this possible in the context of web services?

+2


source to share


2 answers


[ScriptMethod (UseHttpGet = true)]

You can use the above to support the web GET method



http://www.asp.net/ajax/tutorials/understanding-asp-net-ajax-web-services

+1


source


The accepted answer does not answer the question as you need the ASP.NET AJAX extensions for the proposed skins to work in version 2.0.

The simplest alternative to support GET and POST for web service 2.0 is to configure them in web.config:



<system.web>
    <webServices>
        <protocols>
          <add name="HttpPost" />
          <add name="HttpGet" />
        </protocols>
      </webServices>
</system.web>

      

+1


source