Method Property

HttpWebRequest.Method Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Gets or sets the method for the request.

Namespace:  System.Net
Assembly:  System.Net (in System.Net.dll)

public override string Method { get; set; }

Property Value

Type: System.String
The request method to use to contact the Internet resource. The default value is GET.


No method is supplied.


The method string contains invalid characters.


This property is not implemented.


The Method property specifies an unsupported method (TRACE, TRACK, or CONNECT).

The Method property supports HTTP 1.1 or 1.0 protocol verbs other than TRACE, TRACK, and CONNECT. Unsupported verbs throw a NotSupportedException exception.

If an application implements a custom WebRequest class and does not override the Method property, then the NotImplementedException is thrown.

        // Change this Uri to a public server
        System.Uri myUri = new Uri("");

        // Create a 'HttpWebRequest' object.
        HttpWebRequest myHttpWebRequest=(HttpWebRequest)WebRequest.Create(myUri);

        // Set the 'Method' property to "POST".

        // Set the 'ContentType' property.

        // Get the 'ContentType' property and print the current value
        outputBlock.Text += "HttpWebRequest.ContentType: ";
        outputBlock.Text += myHttpWebRequest.ContentType;
        outputBlock.Text += "\n";

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

© 2017 Microsoft