This method downloads a file to byte array from the remote server specified by the URI

[Visual Basic] Public Function DownloadFileToByteArray(ByVal remoteAddress As System.Uri) As Byte()
[C#] public byte[] DownloadFileToByteArray(System.Uri remoteAddress);

Parameters

remoteAddress

The URI to the download file on the remote server

Return Value

Returns data in a byte array if successful, otherwise returns null (Nothing in Visual Basic)

Explanation

The DownloadFileToByteArray method downloads a file to byte array from the remote server specified by the URI.

This method is enabled for HTTP or HTTPS protocol.

Example

[Visual Basic.NET]

Dim _http As New Newtone.ImageKit.WPF.Http
Dim Data As Byte()
'Username and password
_http.Credentials = New NetworkCredential("user", "password")
'Downloads file
Data = _http.DownloadFileToByteArray(New Uri("http://www.newtone.co.jp/test/test.jpg"))

[Visual C#.NET]

Newtone.ImageKit.WPF.Http _http = new Newtone.ImageKit.WPF.Http();
byte[] Data;
//Username and password
_http.Credentials = new NetworkCredential("user", "password");
//Downloads file
Data = _http.DownloadFileToByteArray(new Uri("http://www.newtone.co.jp/test/test.jpg"));

See Also

Http Class | Http Members

 

The ImageKit WPF is created by Newtone Corporation