WebRequest 构造函数
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
初始化 WebRequest 类的新实例。
重载
WebRequest() |
已过时.
初始化 WebRequest 类的新实例。 |
WebRequest(SerializationInfo, StreamingContext) |
已过时.
从 WebRequest 和 SerializationInfo 类的指定实例初始化 StreamingContext 类的新实例。 |
WebRequest()
- Source:
- WebRequest.cs
- Source:
- WebRequest.cs
- Source:
- WebRequest.cs
注意
WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead.
初始化 WebRequest 类的新实例。
protected:
WebRequest();
protected WebRequest ();
[System.Obsolete("WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead.", DiagnosticId="SYSLIB0014", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
protected WebRequest ();
Protected Sub New ()
- 属性
示例
下面的示例演示如何通过在 类上WebRequest调用 Create 方法来创建 WebRequest 实例。
WebRequest^ myRequest = WebRequest::Create( "http://www.contoso.com" );
WebRequest myRequest = WebRequest.Create("http://www.contoso.com");
Dim myRequest As WebRequest = WebRequest.Create("http://www.contoso.com")
注解
Create使用 方法初始化新WebRequest实例。 请勿使用 构造函数。
适用于
WebRequest(SerializationInfo, StreamingContext)
- Source:
- WebRequest.cs
- Source:
- WebRequest.cs
- Source:
- WebRequest.cs
注意
WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead.
从 WebRequest 和 SerializationInfo 类的指定实例初始化 StreamingContext 类的新实例。
protected:
WebRequest(System::Runtime::Serialization::SerializationInfo ^ serializationInfo, System::Runtime::Serialization::StreamingContext streamingContext);
protected WebRequest (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 WebRequest (System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext);
new System.Net.WebRequest : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Net.WebRequest
[<System.Obsolete("WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead.", DiagnosticId="SYSLIB0014", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
new System.Net.WebRequest : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Net.WebRequest
Protected Sub New (serializationInfo As SerializationInfo, streamingContext As StreamingContext)
参数
- serializationInfo
- SerializationInfo
序列化新 WebRequest 实例所需的信息。
- streamingContext
- StreamingContext
StreamingContext,指示与新的 WebRequest 实例关联的序列化流的源。
- 属性
例外
当未在子类中重写该构造函数时,尝试访问该构造函数。
注解
当由后代类实现时,此构造函数实现 ISerializable 子代的 WebRequest 接口。
注意
使用序列化时,应用程序必须在完全信任模式下运行。