Solved

Converting a url to a bytearray

Posted on 2010-08-19
2
344 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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 …
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

911 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

20 Experts available now in Live!

Get 1:1 Help Now