Mono Class Library: System.Net.HttpWebRequest Overview | Members

System.Net.HttpWebRequest.Method Property

Gets or sets the HTTP protocol request method used by the current instance. [Edit]

public override string Method { set; get; }

Value

A string containing an HTTP method. The default value is "GET". [Edit]

Exceptions

TypeReason
ArgumentExceptionnull, string.Empty, or an invalid value was specified for a set operation. [Edit]

Remarks

If the HttpWebRequest.ContentLength property is set to any value other than -1, the HttpWebRequest.Method property is required to be set to a protocol method that sends request data.

The HttpWebRequest.Method property can be set to any of the following HTTP 1.1 protocol methods:

HTTP MethodDescription
GETRetrieves in entity-body form the information identified by the HttpWebRequest.RequestUri property of the current instance.
HEADIdentical to GET except that the message-body is not returned in the response.
POST Requests that the origin server accept the entity enclosed in the request as a new subordinate of the resource identified the Request-URI in the Request-Line.
PUTRequests that the enclosed entity be stored under the supplied Request-URI.
DELETERequests that the origin server delete the resource identified by the Request-URI.
TRACEInvokes a remote, application-layer loopback of the request message.
OPTIONSRequests information about the communication options available on the request/response chain identified by the Request-URI.
Note: This allows the client to determine the options and/or requirements associated with a resource, or the capabilities of a server, without implying a resource action or initiating a resource retrieval.
Note:

For detailed information regarding these methods, see sections 9.2 to 9.8 of RFC 2616.

This property overrides WebRequest.Method .

[Edit]

Requirements

Namespace: System.Net
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0