WebResponse Class
Provides a response from a Uniform Resource Identifier (URI). This is an abstract class.
Assembly: System (in System.dll)
The WebResponse type exposes the following members.
| Name | Description | |
|---|---|---|
![]() ![]() | WebResponse() | Initializes a new instance of the WebResponse class. |
![]() | WebResponse(SerializationInfo, StreamingContext) | Initializes a new instance of the WebResponse class from the specified instances of the SerializationInfo and StreamingContext classes. |
| Name | Description | |
|---|---|---|
![]() ![]() | ContentLength | When overridden in a descendant class, gets or sets the content length of data being received. |
![]() ![]() | ContentType | When overridden in a derived class, gets or sets the content type of the data being received. |
![]() ![]() | Headers | When overridden in a derived class, gets a collection of header name-value pairs associated with this request. |
![]() | IsFromCache | Gets a Boolean value that indicates whether this response was obtained from the cache. |
![]() | IsMutuallyAuthenticated | Gets a Boolean value that indicates whether mutual authentication occurred. |
![]() ![]() | ResponseUri | When overridden in a derived class, gets the URI of the Internet resource that actually responded to the request. |
![]() ![]() | SupportsHeaders |
| Name | Description | |
|---|---|---|
![]() | Close | When overridden by a descendant class, closes the response stream. |
![]() | 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() | |
![]() ![]() | 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 a hash function for a particular type. (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 that is needed to serialize the target object. |
![]() ![]() | GetResponseStream | When overridden in a descendant class, returns the data stream from the Internet resource. |
![]() ![]() | 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.) |
| Name | Description | |
|---|---|---|
![]() ![]() | IDisposable::Dispose | Infrastructure. When overridden in a derived class, releases all resources used by the WebResponse. |
![]() ![]() | ISerializable::GetObjectData | Infrastructure. Populates a SerializationInfo instance with the data that is needed to serialize WebResponse. |
The WebResponse 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 WebResponse class while protocol-specific classes derived from WebResponse carry out the details of the request.
Client applications do not create WebResponse objects directly; they are created by calling the GetResponse method on a WebRequest instance.
The WebResponse class contains new members when it is used in a Portable Class Library project. For more information, see API Differences in Portable Class Library.
Notes to InheritorsWhen you inherit from WebResponse, you must override the following members: ContentLength, ContentType, GetResponseStream, ResponseUri, and Headers.
The following example creates a WebResponse instance from a WebRequest.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.





