我想在这里下载一些产品图片:
“http://www.kelkoo.no/c-100334923-babyutstyr/merke/brio”
我用:
WebClient webClient = new WebClient();
string photourl = "http://r.kelkoo.com/r/no/12085413/100334923/162/162/http%3A%2F%2Fwww.jollyroom.no%2Fmedia%2Fcatalog%2Fproduct%2Fcache%2F5%2Fimage%2F200x200%2F9df78eab33525d08d6e5fb8d27136e95%2F1%2F3%2F138489_1.jpg/R8i4cK4LKSF.G4h1Vyz5UptpU1E3B6l5vcwIb_iyNHQ-";
webClient.DownloadFile(photourl, Application.StartupPath + @"\image\" +i.ToString() +".jpeg");
我得到另一个,一张空白图片!
希望得到你的帮助。
答案 0 :(得分:0)
试试这个
针对Web应用程序更新1 :
using (WebClient webClient = new WebClient())
{
string photourl = "http://r.kelkoo.com/r/no/12085413/100334923/162/162/http%3A%2F%2Fwww.jollyroom.no%2Fmedia%2Fcatalog%2Fproduct%2Fcache%2F5%2Fimage%2F200x200%2F9df78eab33525d08d6e5fb8d27136e95%2F1%2F3%2F138489_1.jpg/R8i4cK4LKSF.G4h1Vyz5UptpU1E3B6l5vcwIb_iyNHQ-";
webClient.DownloadFile(photourl, Server.MapPath(@"\image\" +i.ToString() +".jpeg"));
}
结果:
对于Windows应用程序更新2
using (WebClient webClient = new WebClient())
{
string photourl = "http://r.kelkoo.com/r/no/12085413/100334923/162/162/http%3A%2F%2Fwww.jollyroom.no%2Fmedia%2Fcatalog%2Fproduct%2Fcache%2F5%2Fimage%2F200x200%2F9df78eab33525d08d6e5fb8d27136e95%2F1%2F3%2F138489_1.jpg/R8i4cK4LKSF.G4h1Vyz5UptpU1E3B6l5vcwIb_iyNHQ-";
webClient.DownloadFile(photourl, Application.StartupPath + i.ToString() + ".jpeg");
}
结果: