INFO: HTTP GET and HTTP POST Are Disabled by Default (819267)
The information in this article applies to:
- Microsoft .NET Framework 1.1
SUMMARYThis article discusses changes in the .NET Framework 1.1
that affect the HTTP GET method and the HTTP POST method on a Web server. This article also describes workarounds
for this new functionality.MORE INFORMATIONThe .NET-connected Web services support HTTP GET, HTTP POST
and SOAP protocols. By default, in .NET Framework 1.0, all three protocols are
enabled. By default, in .NET Framework 1.1, HTTP GET and HTTP POST are both
disabled. This is for security reasons. Applications that use HTTP GET
or HTTP POST to invoke a Web service fail when the Web service is upgraded to
.NET Framework 1.1. These applications receive a System.Net.WebException error message that indicates the
request format is unrecognized. Note that the HTML-based test form
uses HTTP POST, and therefore the HTML-based test form does not work in .NET
Framework 1.1. This is true except on localhost as noted below. The
.NET Framework 1.1 defines a new protocol that is named HttpPostLocalhost. By default, this new protocol is enabled. This protocol permits
invoking Web services that use HTTP POST requests from applications on the same
computer. This is true provided the POST URL uses http://localhost, not http://hostname. This permits Web service developers to use the HTML-based test
form to invoke the Web service from the same computer where the Web service
resides. When you try to access the Web service from a remote
computer you do not see the Invoke button. And, you receive the following error
message: The test form is only available for
requests from the local machine WorkaroundHTTP GET and HTTP POST may be enabled by editing the Web.config
file for the vroot where the Web service resides. The following configuration
enables both HTTP GET and HTTP POST: <configuration>
<system.web>
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
</system.web>
</configuration> Alternatively, you can enable these protocols for all Web services on
the computer by editing the <protocols> section in Machine.config. The
following example enables HTTP GET, HTTP POST, and also SOAP and HTTP POST from
localhost: <protocols>
<add name="HttpSoap"/>
<add name="HttpPost"/>
<add name="HttpGet"/>
<add name="HttpPostLocalhost"/>
<!-- Documentation enables the documentation/test pages -->
<add name="Documentation"/>
</protocols>
Modification Type: | Major | Last Reviewed: | 4/24/2003 |
---|
Keywords: | kberrmsg kbWebClasses kbWebServer kbhttp kbhtml kbinfo KB819267 kbAudDeveloper |
---|
|