Question httpWebrequest load an image

Zexor

Well-known member
Joined
Nov 28, 2008
Messages
520
Programming Experience
3-5
i am trying to load an image from the web to a picturebox. But the image seems to be forbidden if i just paste the url on the browser, but it show fine viewing from the webpage or if i click open image on new tab. Is there anyway to just load the image?

VB.NET:
            PictureBox1.Image = System.Drawing.Bitmap.FromStream(Net.HttpWebRequest.Create(New Uri("URL")).GetResponse.GetResponseStream)
 
httpWebrequest

No login reqired. Even from the browser. Its forbidden when I just paste the img URL. It's fine if I right click the image and open on new tab. It's like it's preventing you use their image from another site.
 
It may require something specific in the request headers to indicate that it's not just someone trying to grab the image but rather a browser using it for legitimate purposes.
 
If i use a webbrowser control. The image loads fine. I mean if its already loaded, couldnt i just take that data to a picturebox? Can you do that with webbrowser and/or webrequest?
 
Last edited:
Back
Top