WebResponse Class

 

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

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


[SerializableAttribute]
public ref class WebResponse abstract : MarshalByRefObject, ISerializable, 
	IDisposable

NameDescription
System_CAPS_protmethodWebResponse()

Initializes a new instance of the WebResponse class.

System_CAPS_protmethodWebResponse(SerializationInfo^, StreamingContext)

Initializes a new instance of the WebResponse class from the specified instances of the SerializationInfo and StreamingContext classes.

NameDescription
System_CAPS_pubpropertyContentLength

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

System_CAPS_pubpropertyContentType

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

System_CAPS_pubpropertyHeaders

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

System_CAPS_pubpropertyIsFromCache

Gets a Boolean value that indicates whether this response was obtained from the cache.

System_CAPS_pubpropertyIsMutuallyAuthenticated

Gets a Boolean value that indicates whether mutual authentication occurred.

System_CAPS_pubpropertyResponseUri

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

System_CAPS_pubpropertySupportsHeaders

Gets a value that indicates if headers are supported.

NameDescription
System_CAPS_pubmethodClose()

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

System_CAPS_pubmethodCreateObjRef(Type^)

Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.(Inherited from MarshalByRefObject.)

System_CAPS_pubmethodDispose()

Releases the unmanaged resources used by the WebResponse object.

System_CAPS_protmethodDispose(Boolean)

Releases the unmanaged resources used by the WebResponse object, and optionally disposes of the managed resources.

System_CAPS_pubmethodEquals(Object^)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetLifetimeService()

Retrieves the current lifetime service object that controls the lifetime policy for this instance.(Inherited from MarshalByRefObject.)

System_CAPS_protmethodGetObjectData(SerializationInfo^, StreamingContext)

This API supports the product infrastructure and is not intended to be used directly from your code. Populates a SerializationInfo with the data that is needed to serialize the target object.

System_CAPS_pubmethodGetResponseStream()

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

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodInitializeLifetimeService()

Obtains a lifetime service object to control the lifetime policy for this instance.(Inherited from MarshalByRefObject.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone(Boolean)

Creates a shallow copy of the current MarshalByRefObject object.(Inherited from MarshalByRefObject.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

NameDescription
System_CAPS_pubinterfaceSystem_CAPS_privmethodISerializable::GetObjectData(SerializationInfo^, StreamingContext)

This API supports the product infrastructure and is not intended to be used directly from your code. 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.

Notes to Inheritors:

When 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.

// 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();

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1

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

Return to top
Show: