Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Initializes a new HttpWebRequest instance for the specified URI.
CreateHttp(String) |
Obsolete.
Initializes a new HttpWebRequest instance for the specified URI string. |
CreateHttp(Uri) |
Obsolete.
Initializes a new HttpWebRequest instance for the specified URI. |
Caution
WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead.
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);
[System.Obsolete("WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead.", DiagnosticId="SYSLIB0014", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static System.Net.HttpWebRequest CreateHttp(string requestUriString);
static member CreateHttp : string -> System.Net.HttpWebRequest
[<System.Obsolete("WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead.", DiagnosticId="SYSLIB0014", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
static member CreateHttp : string -> System.Net.HttpWebRequest
Public Shared Function CreateHttp (requestUriString As String) As HttpWebRequest
A URI string that identifies the Internet resource.
An HttpWebRequest instance for the specific URI string.
The request scheme specified in requestUriString
is the http or https scheme.
requestUriString
is null
.
The caller does not have WebPermissionAttribute 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.
The CreateHttp(String) method returns an instance of the HttpWebRequest class for the requestUriString
.
When a URI that begins with http://
or https://
is passed in the requestUriString
parameter, a HttpWebRequest is returned by CreateHttp(String). Any other scheme will throw a 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.
Product | Versions (Obsolete) |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5 (6, 7, 8, 9, 10) |
.NET Framework | 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
UWP | 10.0 |
Caution
WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead.
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);
[System.Obsolete("WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead.", DiagnosticId="SYSLIB0014", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static System.Net.HttpWebRequest CreateHttp(Uri requestUri);
static member CreateHttp : Uri -> System.Net.HttpWebRequest
[<System.Obsolete("WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead.", DiagnosticId="SYSLIB0014", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
static member CreateHttp : Uri -> System.Net.HttpWebRequest
Public Shared Function CreateHttp (requestUri As Uri) As HttpWebRequest
A URI that identifies the Internet resource.
An HttpWebRequest instance for the specific URI string.
The request scheme specified in requestUri
is the http or https scheme.
requestUri
is null
.
The caller does not have WebPermissionAttribute 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.
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.
Product | Versions (Obsolete) |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5 (6, 7, 8, 9, 10) |
.NET Framework | 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
UWP | 10.0 |
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in