Solved

Converting a url to a bytearray

Posted on 2010-08-19
2
351 Views
Last Modified: 2012-05-10
"http://ccms.ochsner.org/tempfiles/PROO688192010105509AM13688694V001_001.GIF"

Assuming the above is a valid URL, and is all the information I have about the file, how do I use VB.NET to convert it to a ByteArray?

Standard file handling code returns "URI format is not supported".

Thanks in advance!
0
Comment
Question by:codefinger
2 Comments
 
LVL 29

Accepted Solution

by:
nffvrxqgrcfqvvc earned 500 total points
ID: 33477201
Do you want to convert the URL string into bytes OR get the bytes of the image that this URL is pointing towards?
 

Dim wc As New System.Net.WebClient
Try
  Dim imageBytes() As Byte = wc.DownloadData("http://www.google.com/intl/en_ALL/images/srpr/logo1w.png")
  ' TODO:// work with byte data
Catch ex As Exception
  MsgBox(ex.Message)
Finally
  wc.Dispose()
  wc = Nothing
End Try

Open in new window

0
 

Author Closing Comment

by:codefinger
ID: 33477672
The answer provided was the one I needed.  Thanks!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question