Solved

Converting a url to a bytearray

Posted on 2010-08-19
2
355 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

738 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