Function DownloadImage(_URL As
String) As Image
Dim _tmpImage As Image = Nothing
Try
Dim _HttpWebRequest As
System.Net.HttpWebRequest = CType(System.Net.HttpWebRequest.Create(_URL),
System.Net.HttpWebRequest)
_HttpWebRequest.AllowWriteStreamBuffering = True
_HttpWebRequest.UserAgent = "Mozilla/4.0
(compatible; MSIE 7.0; Windows NT 5.1)"
_HttpWebRequest.Referer = "http://www.google.com/"
_HttpWebRequest.Timeout = 20000
Dim _WebResponse As
System.Net.WebResponse =
_HttpWebRequest.GetResponse()
Dim _WebStream As
System.IO.Stream =
_WebResponse.GetResponseStream()
_tmpImage = Image.FromStream(_WebStream)
_WebResponse.Close()
_WebStream.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
Return _tmpImage
End Function
no me funciono
ResponderEliminar