WebResponse Class

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Provides a response from a Uniform Resource Identifier (URI). This is an abstract class.

Inheritance Hierarchy

System. . :: . .Object
  System. . :: . .MarshalByRefObject
    System.Net..::..WebResponse
      System.Net. . :: . .FtpWebResponse
      System.Net. . :: . .HttpWebResponse

Namespace:  System.Net
Assembly:  System.Http (in System.Http.dll)

Syntax

'Declaration
Public MustInherit Class WebResponse _
    Inherits MarshalByRefObject _
    Implements IDisposable
public abstract class WebResponse : MarshalByRefObject, 
    IDisposable
public ref class WebResponse abstract : public MarshalByRefObject, 
    IDisposable
[<AbstractClass>]
type WebResponse =  
    class
        inherit MarshalByRefObject
        interface IDisposable
    end
public abstract class WebResponse extends MarshalByRefObject implements IDisposable

The WebResponse type exposes the following members.

Constructors

  Name Description
Protected method WebResponse Initializes a new instance of the WebResponse class.

Top

Properties

  Name Description
Public property ContentLength When overridden in a descendant class, gets or sets the content length of data being received.
Public property ContentType When overridden in a derived class, gets or sets the content type of the data being received.
Public property Headers When overridden in a derived class, gets a collection of header name-value pairs associated with this request.
Public property ResponseUri When overridden in a derived class, gets the URI of the Internet resource that actually responded to the request.

Top

Methods

  Name Description
Public method Close When overridden by a descendant class, closes the response stream.
Public method Dispose() () () () Releases the unmanaged resources used by the WebResponse object.
Protected method Dispose(Boolean) Releases the unmanaged resources used by the WebResponse object, and optionally disposes of the managed resources.
Public method Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Performs clean-up operations. (Overrides Object. . :: . .Finalize() () () ().)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetResponseStream When overridden in a descendant class, returns the data stream from the Internet resource.
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Remarks

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.

Notes to Inheritors

When you inherit from WebResponse, you must override the following members: ContentLength, ContentType, GetResponseStream, ResponseUri, and Headers.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

System.Net Namespace