Solved

Converting a url to a bytearray

Posted on 2010-08-19
2
343 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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

760 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now