This method downloads a file to byte array from the remote server specified by the URI
[Visual Basic] Public Function
DownloadFileToByteArray(ByVal remoteAddress As String) As
Byte()
[C#] public byte[]
DownloadFileToByteArray(string 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("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("http://www.newtone.co.jp/test/test.jpg");
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("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("http://www.newtone.co.jp/test/test.jpg");
See Also