ASP.Net WebServices: Enabling or Disabling POST, GET, and Documentation Requests

It is relatively easy to control access to the various HTTP request types (protocols) for your ASP.Net WebService.

Add something like this to the system.web section of your web.config:

<webServices>
<protocols>
<add name="HttpSoap"/>
<add name="HttpGet"/> <!-- Because this web service is all GET methods remotely -->
<add name="HttpPostLocalhost"/> <!-- So you can test/POST locally -->
<remove name="Documentation"/>  <!-- So the outside world can't see your method documentation -->
<remove name="HttpPost"/> <!-- Remove general POSTs from the outside world -->
</protocols>
</webServices>

Of course you will want to tailor this to the needs of your own web service. :)



This entry was posted in C#, Web Services, WinForms. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>