Windows Dev Center

Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

HttpClient.GetInputStreamAsync | getInputStreamAsync method

Send a GET request to the specified Uri and return the response body as a stream in an asynchronous operation.

Syntax


httpClient.getInputStreamAsync(uri).done( /* Your success and error handlers */ );

Parameters

uri

Type: Windows.Foundation.Uri [JavaScript] | System.Uri [.NET] | Windows::Foundation::Uri [C++]

The Uri the request is sent to.

Return value

Type: IAsyncOperationWithProgress<IInputStream, HttpProgress>

The object representing the asynchronous operation.

Exceptions

A number of exceptions can occur when calling this method. Only a few of the possible errors that can cause exceptions are listed.

You must write code to handle exceptions when you call this method. Exceptions can result from parameter validation errors, name resolutions failures, and network errors. Exceptions from network errors (loss of connectivity, connection failures, and HTTP server failures, for example) can happen at any time. These errors result in exceptions being thrown. If not handled by your app, an exception can cause your entire app to be terminated by the runtime.

An app can use the HRESULT from the exception to learn more detailed information on the error that caused the exception.

For more information on possible exceptions and how to handle exceptions, see Handling exceptions in network apps.

ExceptionCondition
E_INVALIDARG

The uri parameter was a null reference (Nothing in Visual Basic).

Remarks

This operation will not block. The returned IAsyncOperationWithProgress(IInputStream, HttpProgress) object will complete after the whole response body is read. This method does not buffer the stream, so this method can support long streams of arbitrary length.

Requirements (Windows 10 device family)

Device family

Universal

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.Web.Http
Windows::Web::Http [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8.1

Minimum supported server

Windows Server 2012 R2

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.Web.Http
Windows::Web::Http [C++]

Metadata

Windows.winmd

See also

HttpClient
Uri

 

 

Show:
© 2015 Microsoft