Export (0) Print
Expand All

HttpWebResponse Class

Provides an HTTP-specific implementation of the WebResponse class.

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

public abstract class HttpWebResponse : WebResponse

The HttpWebResponse type exposes the following members.

  NameDescription
Protected methodSupported by Silverlight for Windows PhoneHttpWebResponseInitializes a new instance of the WebResponse class.
Top

  NameDescription
Public propertySupported by Silverlight for Windows PhoneContentLengthWhen overridden in a descendant class, gets or sets the content length of data being received. (Inherited from WebResponse.)

In Silverlight for Windows Phone, this member is overridden by ContentLength.


In XNA Framework, this member is overridden by ContentLength.
Public propertySupported by Silverlight for Windows PhoneContentTypeWhen overridden in a derived class, gets or sets the content type of the data being received. (Inherited from WebResponse.)

In Silverlight for Windows Phone, this member is overridden by ContentType.


In XNA Framework, this member is overridden by ContentType.
Public propertySupported by Silverlight for Windows PhoneCookiesGets the cookies used to persist state information for the HTTP response.
Public propertySupported by Silverlight for Windows PhoneHeadersWhen overridden in a derived class, gets a collection of header name-value pairs associated with this request. (Inherited from WebResponse.)

In Silverlight for Windows Phone, this member is overridden by Headers.


In XNA Framework, this member is overridden by Headers.
Public propertySupported by Silverlight for Windows PhoneMethodGets the method that is used to return the response.
Public propertySupported by Silverlight for Windows PhoneResponseUriWhen overridden in a derived class, gets the URI of the Internet resource that actually responded to the request. (Inherited from WebResponse.)

In Silverlight for Windows Phone, this member is overridden by ResponseUri.


In XNA Framework, this member is overridden by ResponseUri.
Public propertySupported by Silverlight for Windows PhoneStatusCodeGets the status of the response.
Public propertySupported by Silverlight for Windows PhoneStatusDescriptionGets the status description returned with the response.
Public propertySupported by Silverlight for Windows PhoneSupportsHeadersGets a value that indicates whether the Headers property is supported by the descendant class for the WebResponse instance. (Inherited from WebResponse.)
Top

  NameDescription
Public methodSupported by Silverlight for Windows PhoneCloseWhen overridden by a descendant class, closes the response stream. (Inherited from WebResponse.)

In Silverlight for Windows Phone, this member is overridden by Close().


In XNA Framework, this member is overridden by Close().
Public methodSupported by Silverlight for Windows PhoneDispose()Releases the resources used by the current instance of the WebResponse class. (Inherited from WebResponse.)
Protected methodSupported by Silverlight for Windows PhoneDispose(Boolean)Called by the Dispose() and Finalize() methods to release the managed and unmanaged resources used by the current instance of the WebResponse class. (Inherited from WebResponse.)

In Silverlight for Windows Phone Windows Phone OS 7.1, this member is Dispose(Boolean).
Public methodSupported by Silverlight for Windows PhoneEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodSupported by Silverlight for Windows PhoneFinalizeAllows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneGetResponseStreamWhen overridden in a descendant class, returns the data stream from the Internet resource. (Inherited from WebResponse.)

In Silverlight for Windows Phone, this member is overridden by GetResponseStream().


In XNA Framework, this member is overridden by GetResponseStream().
Public methodSupported by Silverlight for Windows PhoneGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodSupported by Silverlight for Windows PhoneMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneToStringReturns a string that represents the current object. (Inherited from Object.)
Top

  NameDescription
Explicit interface implemetationPrivate methodSupported by Silverlight for Windows PhoneIDisposable.DisposeInfrastructure. Releases all resources used by the HttpWebResponse.
Top

This class contains support for HTTP-specific uses of the properties and methods of the WebResponse class. The HttpWebResponse class is used to build HTTP stand-alone client applications that send HTTP requests and receive HTTP responses.

You should never directly create an instance of the HttpWebResponse class. Instead, use the instance returned by a call to HttpWebRequest.BeginGetResponse.

You must call either the Close or Stream.Close method to close the response and release the connection for reuse. It is not necessary to call both the Close and the Stream.Close method, 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. Headers for the request can be read from the Headers property as name/value pairs.

The following table shows the values that are available through properties of the HttpWebResponse class.

Header

Property

HTTP method

Method

Status code

StatusCode

Status description

StatusDescription

The contents of the response from the Internet resource are returned as a Stream by calling the GetResponseStream method.

Platform Notes

Silverlight for Windows Phone Silverlight for Windows Phone

 This type is not abstract in Silverlight for Windows Phone.

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft