web form image from remote location

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,
I am trying to get an image to load on a webform, but the image is not
in the localhost directory. The image is actually not even on the same
server. I can not seem to be able to figure out how to do this. Here is
what I am trying. I can hold down ctrl and click on the link and it will
pull up the image, so I am sure it is the correct location, but when I run
the code I get "URI formats not supported". Any ideas?

Dim i As System.Drawing.Image
i = System.Drawing.Image.FromFile("file:///\\server\imgs\00012040.JPG")

Thanks,
Brian
 
Hi

Image.FromFile did not support to load file from a URL.
I think you may try to use the solution below.

'I suggest you put the file on a webserver, because by default the asp.net
application runs under an account of little permission.

Dim wc As New WebClient()
Dim bts As Byte() = wc.DownloadData("http://server/006.jpg");
Response.Clear()
Response.ContentType = "image/jpeg"
Response.BinaryWrite(bts)

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top