I am attempting to read from a url into a System.IO.Stream object. I tried to use
Dim stream as Stream = New FileStream(msgURL, FileMode.Open)
but I get an error that URI formats are not supported with FileStream objects. Is there some method I can use that inherits from System.IO.Stream that is able to read from a URL?
Use WebClient.OpenRead
:
Using wc As New WebClient()
Using stream As Stream = wc.OpenRead(msgURL)
...
End Using
End Using