Question

But default you have to issue an HTTP POST to any web method in an asp.net 2.0 web service. How do u call a web method with HTTP GET alone. In some cases I'd also want to pass arguments to an HTTP GET method. Is this possible in the context of web services?

Was it helpful?

Solution

[ScriptMethod(UseHttpGet = true)]

You can use the above to make the webmethod support GET

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

OTHER TIPS

The accepted answer does not answer the question perfectly since you need the ASP.NET AJAX extensions for the suggested decoration to work in 2.0.

The easiest alternative to support both GET and POST for a 2.0 webservice is to setup these in web.config:

<system.web>
    <webServices>
        <protocols>
          <add name="HttpPost" />
          <add name="HttpGet" />
        </protocols>
      </webServices>
</system.web>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top