System.Net.HttpWebRequest.Method Property

Gets or sets the method for the request.

Syntax

public override string Method { get; set; }

Value

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

Exceptions

TypeReason
ArgumentException null, string.Empty, or an invalid value was specified for a set operation.

Remarks

The HttpWebRequest.Method property can be set to any of the HTTP 1.1 protocol verbs: GET, HEAD, POST, PUT, DELETE, TRACE, or OPTIONS.

If the HttpWebRequest.ContentLength property is set to any value other than -1, the HttpWebRequest.Method property must be set to a protocol property that uploads data.

Requirements

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