System.Net.WebRequest.CreateHttp Method

Initializes a new System.Net.HttpWebRequest instance for the specified URI.

Syntax

[System.MonoTODO("for portable library support")]
public static HttpWebRequest CreateHttp (Uri requestUri)

Parameters

requestUri
A URI that identifies the Internet resource.

Returns

Returns System.Net.HttpWebRequest.

An System.Net.HttpWebRequest instance for the specific URI string.

Remarks

The WebRequest.CreateHttp(Uri) method returns an instance of the System.Net.HttpWebRequest class for the requestUri.

When a URI that begins with http:// or http:// is passed in the requestUri parameter, an System.Net.HttpWebRequest is returned by WebRequest.CreateHttp(Uri). Another other scheme will throw a NotSupportedException.

The WebRequest.CreateHttp(Uri) method uses the requestUri parameter to create a new System.Net.HttpWebRequest instance. If the method is successful, the HttpWebRequest.AllowReadStreamBuffering property on the returned System.Net.HttpWebRequest instance is set to false.

The .NET Framework includes support for the http:// and https:// URI schemes. Custom System.Net.WebRequest descendants to handle other requests are registered with the WebRequest.RegisterPrefix(string, IWebRequestCreate) method. The WebRequest.Create(Uri) method can be used to create a descendant of the System.Net.WebRequest class for other schemes.

Requirements

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