WebRequest Constructors
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 instance of the WebRequest class.
WebRequest() |
Obsolete.
Initializes a new instance of the WebRequest class. |
WebRequest(SerializationInfo, StreamingContext) |
Obsolete.
Initializes a new instance of the WebRequest class from the specified instances of the SerializationInfo and StreamingContext classes. |
- Source:
- WebRequest.cs
- Source:
- WebRequest.cs
- Source:
- WebRequest.cs
Caution
WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead.
Initializes a new instance of the WebRequest class.
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 ()
- Attributes
Examples
The following example shows how to create a WebRequest instance by calling the Create method on the WebRequest class.
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")
Remarks
Use the Create method to initialize new WebRequest instances. Do not use the constructor.
Applies to
.NET 10 i druge verzije
Proizvod | Verzije (Zastarjelo) |
---|---|
.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 | 1.1, 2.0, 3.0, 3.5, 4.0, 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 |
- Source:
- WebRequest.cs
- Source:
- WebRequest.cs
- Source:
- WebRequest.cs
Caution
WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead.
Initializes a new instance of the WebRequest class from the specified instances of the SerializationInfo and StreamingContext classes.
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);
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}")>]
new System.Net.WebRequest : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Net.WebRequest
new System.Net.WebRequest : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Net.WebRequest
Protected Sub New (serializationInfo As SerializationInfo, streamingContext As StreamingContext)
Parameters
- serializationInfo
- SerializationInfo
The information required to serialize the new WebRequest instance.
- streamingContext
- StreamingContext
A StreamingContext that indicates the source of the serialized stream associated with the new WebRequest instance.
- Attributes
Exceptions
Any attempt is made to access the constructor, when the constructor is not overridden in a descendant class.
Remarks
When implemented by a descendant class, this constructor implements the ISerializable interface for the WebRequest descendant.
Napomena
An application must run in full trust mode when using serialization.
See also
Applies to
.NET 10 i druge verzije
Proizvod | Verzije (Zastarjelo) |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5 (6, 7, 8, 9, 10) |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 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 |
Povratne informacije o proizvodu .NET
.NET je projekt otvorenog koda. Odaberite vezu za slanje povratnih informacija: