System.Net.WebRequest.CreateHttp Method

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

Syntax

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

Parameters

requestUriString
A URI string that identifies the Internet resource.

Returns

Returns System.Net.HttpWebRequest.

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

Remarks

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

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

The WebRequest.CreateHttp(string) method uses the requestUriString parameter to create a Uri instance that it passes to the new System.Net.HttpWebRequest. 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(string) 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