Table of Contents

Class WebResponse

Namespace
System.Net
Assembly
System.Net.Http.dll

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

public abstract class WebResponse : MarshalByRefObject, IDisposable
Inheritance
WebResponse
Implements
Derived
Inherited Members
Extension Methods

Remarks

This is the abstract base class for all WebResponse objects.

Constructors

WebResponse()

Initializes a new instance of the WebResponse class.

protected WebResponse()

Properties

ContentLength

When overridden in a descendant class, gets or sets the content length of data being received.

public virtual long ContentLength { get; set; }

Property Value

long

The number of bytes returned from the Internet resource.

ContentType

When overridden in a derived class, gets or sets the content type of the data being received.

public virtual string ContentType { get; set; }

Property Value

string

A string that contains the content type of the response.

Headers

When overridden in a derived class, gets a collection of header name-value pairs associated with this request.

public virtual WebHeaderCollection Headers { get; }

Property Value

WebHeaderCollection

An instance of the WebHeaderCollection class that contains header values associated with this response.

ResponseUri

When overridden in a derived class, gets the URI of the Internet resource that actually responded to the request.

public virtual Uri ResponseUri { get; }

Property Value

Uri

An instance of the Uri class that contains the URI of the Internet resource that actually responded to the request.

Remarks

This property gets the final Response URI, that includes any changes that may have transpired from the orginal request.

Methods

Close()

When overridden by a descendant class, closes the response stream.

public virtual void Close()

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

Dispose(bool)

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

Finalize()

protected override void Finalize()

GetResponseStream()

When overridden in a descendant class, returns the data stream from the Internet resource.

public virtual Stream GetResponseStream()

Returns

Stream

An instance of the Stream class for reading data from the Internet resource.