Networking
System
[00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ]
1.0.x.x
1.0.5000.0
2.0.0.0
4.0.0.0
All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe.
System.Net.WebResponse
System.IDisposable
System.Runtime.Serialization.ISerializable
This class contains support for HTTP-specific uses of the properties and methods of the class. The class is used to build HTTP stand-alone client applications that send HTTP requests and receive HTTP responses.
Do not confuse with the class that is used in ASP.NET applications and whose methods and properties are exposed through ASP.NET's intrinsic Response object.
You should never directly create an instance of the class. Instead, use the instance returned by a call to . You must call either the or the method to close the response and release the connection for reuse. It is not necessary to call both and , but doing so does not cause an error.
Common header information returned from the Internet resource is exposed as properties of the class. See the following table for a complete list. Other headers can be read from the property as name/value pairs.
The following table shows the common HTTP headers that are available through properties of the class.
-
Header
Property
-
Content-Encoding
-
Content-Length
-
Content-Type
-
Last-Modified
-
Server
The contents of the response from the Internet resource are returned as a by calling the method.
Provides an HTTP-specific implementation of the class.
Constructor
1.0.5000.0
2.0.0.0
4.0.0.0
System.Obsolete("Serialization is obsoleted for this type", false)
This constructor implements the interface for the class.
Initializes a new instance of the class from the specified and instances.
A that contains the information required to serialize the new .
A that contains the source of the serialized stream that is associated with the new .
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.String
A that
represents the character set used for the current instance.
The current instance has been disposed.
The property contains a value that describes the character set of the response. This character set information is taken from the header returned with the response.
Gets the character set of the response.
0
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Void
The method closes the response stream and releases the connection to the resource for reuse by other requests.
You must call either the or the method to close the stream and release the connection for reuse. It is not necessary to call both and , but doing so does not cause an error. Failure to close the stream can cause your application to run out of connections.
This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].
Closes the response stream.
0
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.String
A that describes the method used to encode the body of the response.
The current instance has been disposed.
The property contains the value of the Content-Encoding header returned with the response.
Gets the method that is used to encode the body of the response.
0
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.Int64
A
containing the number of bytes returned from the Internet resource. This
value does not include header information.
The current instance has been disposed.
The property contains the value of the Content-Length header returned with the response. If the Content-Length header is not set in the response, is set to the value -1.
Gets the length of the content returned by the request.
0
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.String
A that
represents the content type of the response data.
The current instance has been disposed.
The property contains the value of the Content-Type header returned with the response.
Gets the content type of the response.
0
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.Net.CookieCollection
To be added.
The property provides an instance of the class that holds the cookies associated with this response.
If the property of the associated is null, the property will also be null. Any cookie information sent by the server will be available in the property, however.
Gets or sets the cookies that are associated with this response.
Method
1.0.5000.0
4.0.0.0
System.Void
This method is called by the public Dispose() method and the method. Dispose() invokes the protected Dispose(Boolean) method with the parameter set to true. invokes Dispose with set to false.
When the parameter is true, this method releases all resources held by any managed objects that this references. This method invokes the Dispose() method of each referenced object.
This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].
Releases the unmanaged resources used by the , and optionally disposes of the managed resources.
true to release both managed and unmanaged resources; false to releases only unmanaged resources.
0
Method
System.Int32
The current instance has been disposed.
The method returns a hash code of the web response instance. This value can be used as a key in hash tables.
Returns a hash value for a instance.
An integer hash value.
0
1.0.5000.0
Method
2.0.0.0
4.0.0.0
System.Void
Any objects that are included in the are automatically tracked and serialized by the formatter.
Populates a with the data needed to serialize the target object.
The to populate with data.
A that specifies the destination for this serialization.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.String
The current instance has been disposed.
Use to retrieve the contents of particular headers. You must specify which header you want to return.
Gets the contents of a header that was returned with the response.
The contents of the specified header.
The header value to return.
0
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.IO.Stream
The current instance has been disposed.
The method returns the data stream from the requested Internet resource.
You must call either the or the method to close the stream and release the connection for reuse. It is not necessary to call both and , but doing so does not cause an error. Failure to close the stream will cause your application to run out of connections.
This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].
Gets the stream that is used to read the body of the response from the server.
A containing the body of the response.
0
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.Net.WebHeaderCollection
A containing the header information returned with the
response.
The current instance has been disposed.
The property is a collection of name/value pairs that contain the HTTP header values returned with the response. Common header information returned from the Internet resource is exposed as properties of the class. The following table lists common headers that the API exposes as properties.
-
Header
Property
-
Content-Encoding
-
Content-Length
-
Content-Type
-
Last-Modified
-
Server
Gets the headers that are associated with this response from the server.
0
Property
2.0.0.0
4.0.0.0
System.MonoTODO
System.Boolean
To be added.
You can specify mutual authentication using the property.
Gets a value that indicates whether both client and server were authenticated.
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.DateTime
A
value containing the date and time the contents of the response were
modified.
The current instance has been disposed.
The property contains the value of the Last-Modified header received with the response. The date and time are assumed to be local time.
Gets the last date and time that the contents of the response were modified.
0
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.String
A that represents the HTTP method used to return the response.
The current instance has been disposed.
returns the method that is used to return the response. Common HTTP methods are GET, HEAD, POST, PUT, and DELETE.
Gets the method that is used to return the response.
0
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.Version
A
that contains the HTTP protocol version of the response.
The current instance has been disposed.
The property contains the HTTP protocol version number of the response sent by the Internet resource.
Gets the version of the HTTP protocol that is used in the response.
0
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.Uri
A
representing the resource that actually responded to the request.
The current instance has been disposed.
The property contains the URI of the Internet resource that actually responded to the request. This URI might not be the same as the originally requested URI, if the original server redirected the request.
The property will use the Content-Location header if present.
Applications that need to access the last redirected should use the property rather than , since the use of property may open security vulnerabilities.
Gets the URI of the Internet resource that responded to the request.
0
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.String
A containing the name of the server that sent the response.
The current instance has been disposed.
The property contains the value of the Server header returned with the response.
Gets the name of the server that sent the response.
0
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.Net.HttpStatusCode
A value.
The current instance has been disposed.
The parameter is a number that indicates the status of the HTTP response. The expected values for status are defined in the class.
Gets the status of the response.
0
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.String
A that describes the status of the response.
The current instance has been disposed.
A common status message is OK.
Gets the status description returned with the response.
0
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Void
Call when you are finished using the . The method leaves the in an unusable state. After calling , you must release all references to the so the garbage collector can reclaim the memory that the was occupying. For more information, see [<topic://cpconCleaningUpUnmanagedResources>] and [<topic://cpconImplementingDisposeMethod>].
Note: Always call before you release your last reference to the . Otherwise, the resources it is using will not be freed until the garbage collector calls the object's Finalize method.
Releases all resources used by the .
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Void
To be added.
Serializes this instance into the specified object.
The object into which this will be serialized.
The destination of the serialization.
0