共用方式為


HttpWebRequest 建構函式

定義

初始化 HttpWebRequest 類別的新實例。 這些建構函式已經過時;如需詳細資訊,請參閱一節。

多載

HttpWebRequest()
已淘汰.
已淘汰.

初始化 HttpWebRequest 類別的新實例。 這個建構函式已經過時。

HttpWebRequest(SerializationInfo, StreamingContext)
已淘汰.
已淘汰.
已淘汰.
已淘汰.

SerializationInfoStreamingContext 類別的指定實例,初始化 HttpWebRequest 類別的新實例。 這個建構函式已經過時。

備註

謹慎

WebRequestHttpWebRequestServicePointWebClient 已經過時,您不應該將它們用於新的開發。 請改用 HttpClient

這兩個 HttpWebRequest 建構函式都已經過時,而且不應該使用。 呼叫 WebRequest.CreateHttp 方法來初始化新的 HttpWebRequest 物件。

HttpWebRequest()

警告

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

警告

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

初始化 HttpWebRequest 類別的新實例。 這個建構函式已經過時。

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 ()
屬性

適用於

HttpWebRequest(SerializationInfo, StreamingContext)

來源:
HttpWebRequest.cs
來源:
HttpWebRequest.cs
來源:
HttpWebRequest.cs

警告

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

警告

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

警告

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

警告

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

SerializationInfoStreamingContext 類別的指定實例,初始化 HttpWebRequest 類別的新實例。 這個建構函式已經過時。

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)

參數

serializationInfo
SerializationInfo

SerializationInfo 物件,其中包含串行化新 HttpWebRequest 物件所需的資訊。

streamingContext
StreamingContext

StreamingContext 物件,其中包含與新 HttpWebRequest 對象相關聯之串行化數據流的來源和目的地。

屬性

備註

使用串行化時,應用程式必須以完全信任模式執行。

另請參閱

適用於