日期:2014-05-17 浏览次数:20505 次
protected void Button1_Click(object sender, EventArgs e)
{
WebRequest wreq = WebRequest.Create("http://www.xxx.com/img/bdlogo.gif");
HttpWebResponse wresp = (HttpWebResponse)wreq.GetResponse();
Stream s = wresp.GetResponseStream();
System.Drawing.Image img;
img = System.Drawing.Image.FromStream(s);
string path = Request.FilePath;
img.Save(Server.MapPath("~/1.jpg")); //保存
}
Random seed = new Random();
System.Net.WebRequest webreq = System.Net.WebRequest.Create("http://www.xxx.com/img/bdlogo.gif?aid=&" + seed.NextDouble());
System.Net.WebResponse webres = webreq.GetResponse();
Stream stream = webres.GetResponseStream();
Image image;
image = Image.FromStream(stream);
stream.Close();
string path = Request.FilePath;
image.Save(Server.MapPath("~/1.jpg"));