This method downloads a file to byte array from the remote server specified by a scheme, host name, and path.

[Visual Basic] Public Function DownloadFileToByteArray(ByVal scheme As String, ByVal remoteHost As String, ByVal remotePath As String) As Byte()
[C#] public byte[] DownloadFileToByteArray(string scheme, string remoteHost, string remotePath);

Parameters

scheme

Internet Access Protocol ("http" or "https")

remoteHost

DNS style domain name or IP address

remotePath

Remote server name

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 a scheme, host name, and path.

This method is enabled for HTTP or HTTPS protocol.

Example:

[Visual Basic.NET]

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

[Visual C#.NET]

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

See Also

Http Class | Http Members

 

The ImageKit.NET X is created by Newtone Corporation