WebRequest.CreateHttp WebRequest.CreateHttp WebRequest.CreateHttp WebRequest.CreateHttp Method

Definition

Initializes a new HttpWebRequest instance for the specified URI.

Overloads

CreateHttp(String) CreateHttp(String) CreateHttp(String) CreateHttp(String)

Initializes a new HttpWebRequest instance for the specified URI string.

CreateHttp(Uri) CreateHttp(Uri) CreateHttp(Uri) CreateHttp(Uri)

Initializes a new HttpWebRequest instance for the specified URI.

CreateHttp(String) CreateHttp(String) CreateHttp(String) CreateHttp(String)

Initializes a new HttpWebRequest instance for the specified URI string.

public:
 static System::Net::HttpWebRequest ^ CreateHttp(System::String ^ requestUriString);
public static System.Net.HttpWebRequest CreateHttp (string requestUriString);
static member CreateHttp : string -> System.Net.HttpWebRequest
Public Shared Function CreateHttp (requestUriString As String) As HttpWebRequest
Parameters
requestUriString
String String String String

A URI string that identifies the Internet resource.

Returns

An HttpWebRequest instance for the specific URI string.

Exceptions

The request scheme specified in requestUriString is the http or https scheme.

The caller does not have permission to connect to the requested URI or a URI that the request is redirected to.

The URI specified in requestUriString is not a valid URI.

Remarks

The CreateHttp(String) method returns an instance of the HttpWebRequest class for the requestUriString.

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

The CreateHttp(String) method uses the requestUriString parameter to create a Uri instance that it passes to the new HttpWebRequest. If the method is successful, the AllowReadStreamBuffering property on the returned HttpWebRequest instance is set to false.

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

CreateHttp(Uri) CreateHttp(Uri) CreateHttp(Uri) CreateHttp(Uri)

Initializes a new HttpWebRequest instance for the specified URI.

public:
 static System::Net::HttpWebRequest ^ CreateHttp(Uri ^ requestUri);
public static System.Net.HttpWebRequest CreateHttp (Uri requestUri);
static member CreateHttp : Uri -> System.Net.HttpWebRequest
Public Shared Function CreateHttp (requestUri As Uri) As HttpWebRequest
Parameters
requestUri
Uri Uri Uri Uri

A URI that identifies the Internet resource.

Returns

An HttpWebRequest instance for the specific URI string.

Exceptions

The request scheme specified in requestUri is the http or https scheme.

The caller does not have permission to connect to the requested URI or a URI that the request is redirected to.

The URI specified in requestUri is not a valid URI.

Remarks

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

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

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

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

Applies to