我想通过.Load()方法将图片添加到PictureBox。该图片的问题在于它停留在需要身份验证的网站上!
我该如何解决这个问题?
答案 0 :(得分:0)
解决这个问题:
public Bitmap getImageFromURL(string sURL)
{
HttpWebRequest Request = (HttpWebRequest)WebRequest.Create(sURL);
Request.Method = "GET";
Request.UseDefaultCredentials = true;
HttpWebResponse Response = (HttpWebResponse)Request.GetResponse();
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(Response.GetResponseStream());
Response.Close();
return bmp;
}