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.MarshalByRefObject
System.IDisposable
System.Runtime.Serialization.ISerializable
The following example creates a
instance from a
.
using System;
using System.Net;
public class WebResponseExample {
public static void Main() {
// Initialize the WebRequest.
WebRequest myRequest =
WebRequest.Create("http://www.contoso.com");
// Return the response.
WebResponse myResponse = myRequest.GetResponse();
// Code to use the WebResponse goes here.
// Close the response to free resources.
myResponse.Close();
}
}
The class is the abstract base class from which protocol-specific response classes are derived. Applications can participate in request and response transactions in a protocol-agnostic manner using instances of the class while protocol-specific classes derived from carry out the details of the request.
Client applications do not create objects directly; they are created by calling the method on a instance.
Provides a response from a Uniform Resource Identifier (URI). This is an abstract class.
Constructor
1.0.5000.0
2.0.0.0
4.0.0.0
Applications do not call the constructor directly; use the method on a instance.
Initializes a new instance of the class.
0
Constructor
1.0.5000.0
2.0.0.0
4.0.0.0
When implemented by a descendant class, this constructor implements the interface for the descendant.
Initializes a new instance of the class from the specified instances of the and classes.
An instance of the class that contains the information required to serialize the new instance.
An instance of the class that indicates the source of the serialized stream that is associated with the new instance.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Void
This method is not implemented in the derived class.
The method cleans up the resources used by a and closes the underlying stream by calling the method.
The response must be closed to avoid running out of system resources. The response stream can be closed by calling or .
The class is an abstract class. The actual behavior of instances at run time is determined by the descendant class returned by . For more information about default values and exceptions, please see the documentation for the descendant classes, such as and .
When overridden by a descendant class, closes the response stream.
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 resource.
This property is not implemented in the derived class.
The property contains the length, in bytes, of the response from the Internet resource. For request methods that contain header information, the does not include the length of the header information.
The class is an abstract class. The actual behavior of instances at run time is determined by the descendant class returned by . For more information about default values and exceptions, please see the documentation for the descendant classes, such as and .
When overridden in a descendant class, gets or sets the content length of data being received.
0
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.String
A that
contains the media type of the response data.
This property is not implemented in the derived class.
The property contains the MIME content type of the response from the Internet resource, if known.
The class is an abstract class. The actual behavior of instances at run time is determined by the descendant class returned by . For more information about default values and exceptions, please see the documentation for the descendant classes, such as and .
When overridden in a derived class, gets or sets the content type of the data being received.
0
Method
4.0.0.0
System.Void
To be added.
Releases the unmanaged resources used by the object.
Method
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 object, and optionally disposes of the managed resources.
true to release both managed and unmanaged resources; false to releases only unmanaged resources.
Method
2.0.0.0
4.0.0.0
System.MonoTODO
System.Void
Any objects included in the are automatically tracked and serialized by the formatter.
Populates a with the data that is 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.IO.Stream
This method is not implemented in the derived class.
The method returns the data stream from the Internet resource.
The response stream must be closed to avoid running out of system resources. The response stream can be closed by calling or
When overridden in a descendant class, returns the data stream from the Internet resource.
An instance of the class for reading data from the Internet resource.
0
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.Net.WebHeaderCollection
A containing the header name/value pairs associated
with the current instance.
This property is not implemented in the derived class.
The property contains the name-value header pairs returned in the response.
The class is an abstract class. The actual behavior of instances at run time is determined by the descendant class returned by . For more information about default values and exceptions, please see the documentation for the descendant classes, such as and .
When overridden in a derived class, gets a collection of header name-value pairs associated with this request.
0
Property
2.0.0.0
4.0.0.0
System.MonoTODO
System.Boolean
To be added.
The current cache policy and the presence of the requested resource in the cache determine whether a response can be retrieved from the cache. Using cached responses usually improves application performance, but there is a risk that the response in the cache does not match the response on the server. Use the property to set and the class to enumerate the current caching policy.
Gets a value that indicates whether this response was obtained from the cache.
Property
2.0.0.0
4.0.0.0
System.MonoTODO
System.Boolean
To be added.
To request mutual authentication, set the property using the or enumeration value. The default value for the property contains and .
Gets a value that indicates whether mutual authentication occurred.
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.Uri
A containing the URI
of the resource associated with the current response.
This property is not implemented in the derived class.
The property contains the URI of the Internet resource that actually provided the response data. This resource might not be the originally requested URI if the underlying protocol allows redirection of the request.
The class is an abstract class. The actual behavior of instances at run time is determined by the descendant class returned by . For more information about default values and exceptions, please see the documentation for the descendant classes, such as and .
When overridden in a derived class, gets the URI of the Internet resource that actually responded to the request.
0
Property
4.0.0.0
System.MonoTODO("for portable library support")
System.Boolean
To be added.
This property is always true for net_v45.
Gets a value that indicates if headers are supported.
Method
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 Cleaning Up Unmanaged Resources and Implementing a Dispose Method.
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.
When overridden in a derived class, releases all resources used by the .
0
1.0.5000.0
2.0.0.0
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Void
To be added.
Populates a instance with the data that is needed to serialize .
A that will hold the serialized data for the .
A that contains the destination of the serialized stream that is associated with the new .
0