Bewerken

Share via


HttpWebRequest Constructors

Definition

Initializes a new instance of the HttpWebRequest class. These constructors are obsolete; see the Remarks section for details.

Overloads

HttpWebRequest()
Obsolete.
Obsolete.

Initializes a new instance of the HttpWebRequest class. This constructor is obsolete.

HttpWebRequest(SerializationInfo, StreamingContext)
Obsolete.
Obsolete.
Obsolete.
Obsolete.

Initializes a new instance of the HttpWebRequest class from the specified instances of the SerializationInfo and StreamingContext classes. This constructor is obsolete.

Remarks

Caution

WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete, and you shouldn't use them for new development. Use HttpClient instead.

Both HttpWebRequest constructors are obsolete and should not be used. Call the WebRequest.CreateHttp method to initialize new HttpWebRequest objects.

HttpWebRequest()

Caution

This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.

Caution

This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.

Initializes a new instance of the HttpWebRequest class. This constructor is obsolete.

public:
 HttpWebRequest();
[System.Obsolete("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)]
[System.Obsolete("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)]
public HttpWebRequest ();
[System.Obsolete("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)]
public HttpWebRequest ();
Public Sub New ()
Attributes

Applies to

HttpWebRequest(SerializationInfo, StreamingContext)

Source:
HttpWebRequest.cs
Source:
HttpWebRequest.cs
Source:
HttpWebRequest.cs

Caution

Serialization is obsoleted for this type. https://go.microsoft.com/fwlink/?linkid=14202

Caution

WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead

Caution

WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead.

Caution

Serialization is obsoleted for this type. http://go.microsoft.com/fwlink/?linkid=14202

Initializes a new instance of the HttpWebRequest class from the specified instances of the SerializationInfo and StreamingContext classes. This constructor is obsolete.

protected:
 HttpWebRequest(System::Runtime::Serialization::SerializationInfo ^ serializationInfo, System::Runtime::Serialization::StreamingContext streamingContext);
[System.Obsolete("Serialization is obsoleted for this type.  https://go.microsoft.com/fwlink/?linkid=14202")]
protected HttpWebRequest (System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext);
[System.Obsolete("WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead", DiagnosticId="SYSLIB0014", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
protected HttpWebRequest (System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext);
[System.Obsolete("WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead.", DiagnosticId="SYSLIB0014", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
protected HttpWebRequest (System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext);
[System.Obsolete("Serialization is obsoleted for this type.  http://go.microsoft.com/fwlink/?linkid=14202")]
protected HttpWebRequest (System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext);
protected HttpWebRequest (System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext);
[<System.Obsolete("Serialization is obsoleted for this type.  https://go.microsoft.com/fwlink/?linkid=14202")>]
new System.Net.HttpWebRequest : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Net.HttpWebRequest
[<System.Obsolete("WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead", DiagnosticId="SYSLIB0014", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
new System.Net.HttpWebRequest : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Net.HttpWebRequest
[<System.Obsolete("WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead.", DiagnosticId="SYSLIB0014", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
new System.Net.HttpWebRequest : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Net.HttpWebRequest
[<System.Obsolete("Serialization is obsoleted for this type.  http://go.microsoft.com/fwlink/?linkid=14202")>]
new System.Net.HttpWebRequest : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Net.HttpWebRequest
new System.Net.HttpWebRequest : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Net.HttpWebRequest
Protected Sub New (serializationInfo As SerializationInfo, streamingContext As StreamingContext)

Parameters

serializationInfo
SerializationInfo

A SerializationInfo object that contains the information required to serialize the new HttpWebRequest object.

streamingContext
StreamingContext

A StreamingContext object that contains the source and destination of the serialized stream associated with the new HttpWebRequest object.

Attributes

Remarks

An application must run in full trust mode when using serialization.

See also

Applies to