Creating a ASMX-page to leverage some service functionality to a client is fairly easy. The nice thing about that is, that you can even consume these services from JavaScript.
But out-of-the-box you can only call those services either via SOAP 1.1, SOAP 1.2 or a POST-request. But what if you want to use a plain-ol’ GET-request? You’ll always get an error-message stating, that GET is not supported – what a bummer.
But working around this problem is quite easy to do. Just open up your code-behind of your ASMX-Service and add
[ScriptMethod(UseHttpGet = true)]
To the method you’re calling. Finally you’ll also have to add the HTTP-GET to the list of "known" protocolls for webservices in the web.config. This is done by adding
<webServices> <protocols> <add name="HttpGet"/> </protocols> </webServices>
to the system.web
section in the web.config
.
Thats all.