Provides an HTTP-specific implementation of the WebResponse class.
Assemblies: System (in System.dll)
System.Net.Requests (in System.Net.Requests.dll)
Thetype exposes the following members.
|HttpWebResponse()||Obsolete. Initializes a new instance of the class.|
|HttpWebResponse(SerializationInfo, StreamingContext)||Obsolete. Initializes a new instance of the class from the specified SerializationInfo and StreamingContext instances.|
|CharacterSet||Gets the character set of the response.|
|ContentEncoding||Gets the method that is used to encode the body of the response.|
|ContentLength||Gets the length of the content returned by the request. (Overrides WebResponse.ContentLength.)|
|ContentType||Gets the content type of the response. (Overrides WebResponse.ContentType.)|
|Cookies||Gets or sets the cookies that are associated with this response.|
|Headers||Gets the headers that are associated with this response from the server. (Overrides WebResponse.Headers.)|
|IsFromCache||Gets a Boolean value that indicates whether this response was obtained from the cache. (Inherited from WebResponse.)|
|IsMutuallyAuthenticated||Gets a Boolean value that indicates whether both client and server were authenticated. (Overrides WebResponse.IsMutuallyAuthenticated.)|
|LastModified||Gets the last date and time that the contents of the response were modified.|
|Method||Gets the method that is used to return the response.|
|ProtocolVersion||Gets the version of the HTTP protocol that is used in the response.|
|ResponseUri||Gets the URI of the Internet resource that responded to the request. (Overrides WebResponse.ResponseUri.)|
|Server||Gets the name of the server that sent the response.|
|StatusCode||Gets the status of the response.|
|StatusDescription||Gets the status description returned with the response.|
|SupportsHeaders||Gets a value that indicates if headers are supported. (Overrides WebResponse.SupportsHeaders.)|
|Close||Closes the response stream. (Overrides WebResponse.Close().)|
|CreateObjRef||Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.)|
|Dispose()||Releases the unmanaged resources used by the WebResponse object. (Inherited from WebResponse.)|
|Dispose(Boolean)||Releases the unmanaged resources used by the , and optionally disposes of the managed resources. (Overrides WebResponse.Dispose(Boolean).)|
|Equals(Object)||Determines whether the specified object is equal to the current object. (Inherited from Object.)|
|Finalize||Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)|
|GetHashCode||Serves as the default hash function. (Inherited from Object.)|
|GetLifetimeService||Retrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.)|
|GetObjectData||Infrastructure. Populates a SerializationInfo with the data needed to serialize the target object. (Overrides WebResponse.GetObjectData(SerializationInfo, StreamingContext).)|
|GetResponseHeader||Gets the contents of a header that was returned with the response.|
|GetResponseStream||Gets the stream that is used to read the body of the response from the server. (Overrides WebResponse.GetResponseStream().)|
|GetType||Gets the Type of the current instance. (Inherited from Object.)|
|InitializeLifetimeService||Obtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.)|
|MemberwiseClone()||Creates a shallow copy of the current Object. (Inherited from Object.)|
|MemberwiseClone(Boolean)||Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject.)|
|ToString||Returns a string that represents the current object. (Inherited from Object.)|
|IDisposable.Dispose()||Infrastructure. When overridden in a derived class, releases all resources used by the WebResponse. (Inherited from WebResponse.)|
|IDisposable.Dispose()||Infrastructure. Releases all resources used by the .|
|ISerializable.GetObjectData||Infrastructure. Serializes this instance into the specified SerializationInfo object.|
This class contains support for HTTP-specific uses of the properties and methods of the WebResponse 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 HttpResponse 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 HttpWebRequest.GetResponse. You must call either the Stream.Close or the HttpWebResponse.Close method to close the response and release the connection for reuse. It is not necessary to call both Stream.Close and HttpWebResponse.Close, 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 Headers property as name/value pairs.
The following table shows the common HTTP headers that are available through properties of the class.
.NET FrameworkSupported in: 4.6, 4, 3.5, 3.0, 2.0, 1.1, 1.0
.NET Framework Client ProfileSupported in: 4, 3.5 SP1
Portable Class LibrarySupported in: Portable Class Library
.NET for Windows Store appsSupported in: Windows 8
Supported in: Windows Phone 8.1
Supported in: Windows Phone Silverlight 8.1
Supported in: Windows Phone Silverlight 8
Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.