[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Converting a url to a bytearray

Posted on 2010-08-19
2
Medium Priority
?
369 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 2000 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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Integration Management Part 2
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

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